{"library":"pytest-parametrization","title":"pytest-parametrization","description":"pytest-parametrization is a Pytest plugin that aims to provide a simpler and more explicit way to parametrize test functions compared to the built-in `@pytest.mark.parametrize` decorator. It allows for clearer definition of test cases by separating parameter names from their values. The current version is 2022.2.1, with an irregular release cadence; the last PyPI update was in May 2022.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install pytest-parametrization"],"cli":null},"imports":["from parametrization import parametrize"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from parametrization import parametrize\nimport pytest\n\n@parametrize(\n    a=[1, 2],\n    b=[2, 4]\n)\ndef test_addition(a, b):\n    assert a + b == a + b\n\n@parametrize(\n    num=[(1, 'one'), (2, 'two')],\n    ids=['test_one', 'test_two']\n)\ndef test_number_to_word(num, ids):\n    number, word = num\n    if number == 1:\n        assert word == 'one'\n    elif number == 2:\n        assert word == 'two'\n\n# To run: pytest -v your_test_file.py","lang":"python","description":"This example demonstrates how to use the `@parametrize` decorator from the `pytest-parametrization` plugin. It allows defining parameters using keyword arguments, where the values for each parameter are lists. The plugin also supports custom test IDs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}