parameterized
parameterized copied to clipboard
Parameterized testing with any Python test framework
Ex: ``` @parameterized.expand([(True,), (False,)]) @parameterized.expand([(0,), (1,)]) def test_test(_bool, _num): """ would get: True 0 False 0 True 1 False 1 """ ```
add subtest for unittest fix issue #98 #37
# An iterable of params @parameterized( param.explicit(*json.loads(line)) for line in open("testcases.jsons") ) def test_from_json_file(...): ... Trying to follow the guide of loading json file, is there any particular format of...
@parameterized.expand is not compatible with type hinting. Minimal working example (python 3.8, unittest) ``` def foo_bar_provider() -> List[List]: return [['foo'], ['bar']] @parameterized.expand(foo_bar_provider) def test_foo_bar(self, provider: str): ``` Gives the following...
I have a piece of code similar to the following: ``` @patch('service.account.utils.AccountManager.get_service', MOCK_SERVICE) # ... more @patch decorators ... @parameterized_class('provider', [ (GCPServiceProvider(),), (AWSServiceProvider(),), ]) class ServiceTestCase(BaseTestCase): # ... tests ```...
With `nose-parameterized` version 0.3.3, we were able to directly call a parameterized test, supplying an appropriate list of parameters, from another test (eg after doing some other setup). When updating...
With Pytest I routinely nest parameterizations. ``` @parameterized_class( "X", [1, 2], ) @parameterized_class( "Y", [10, 20], ) class TestTutorials(unittest.TestCase): def test_stuff(self): ... ``` I tried something similar got got an...
There should be no need to declare an extra unused parameter just because of adding a name. ''' class TestMathUnitTest(unittest.TestCase): @parameterized.expand([ ("negative", -1.5, -2.0), ("integer", 1, 1.0), ("large fraction", 1.6,...
Almost half of my pytest collection time is spent inside `parameterized.expand`, specifically inside `inspect.stack`. I tried switching to `inspect.currentframe` and it's significantly faster as it doesn't have to assemble the...
When the user uses `param()` to declare their data, it is possible to know the line number and location of the place where `param` was called. This information could be...