{"id":24200,"library":"parametrize","title":"parametrize","description":"A drop-in replacement for @pytest.mark.parametrize that works with unittest.TestCase classes, enabling parameterized tests without needing pytest. Current version 0.2.0. Development appears low-activity.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/MrMrRobat/parametrize","tags":["testing","unittest","parameterized","parametrize","decorator"],"install":[{"cmd":"pip install parametrize","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Direct import without submodule leads to AttributeError on parametrize decorator.","wrong":"import parametrize","symbol":"parametrize","correct":"from parametrize import parametrize"}],"quickstart":{"code":"import unittest\nfrom parametrize import parametrize\n\nclass TestMath(unittest.TestCase):\n    @parametrize('a,b,expected', [\n        (1, 1, 2),\n        (2, 2, 4),\n        (3, 5, 8)\n    ])\n    def test_add(self, a, b, expected):\n        self.assertEqual(a + b, expected)\n\nif __name__ == '__main__':\n    unittest.main()","lang":"python","description":"Basic usage with unittest.TestCase showing parameterized tests."},"warnings":[{"fix":"Use @pytest.mark.parametrize and run tests with pytest instead of unittest.","message":"parametrize is not actively maintained; consider using pytest's built-in parametrize directly if you can migrate tests away from unittest.TestCase.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure @parametrize is directly above the test method, with no other decorator in between.","message":"The decorator must be placed above the method definition, not below. Placing it below will silently not work.","severity":"gotcha","affected_versions":"all"},{"fix":"Check that the comma-separated argument names match the method signature.","message":"Argument names in the string must exactly match method parameters. A mismatch will cause a TypeError at test execution.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"from parametrize import parametrize","cause":"Import using import parametrize instead of from parametrize import parametrize.","error":"AttributeError: module 'parametrize' has no attribute 'parametrize'"},{"fix":"Ensure the argument names string (e.g., 'a,b,expected') matches method parameters exactly.","cause":"Argument names in the decorator string do not match method parameters, or the tuple lengths mismatch.","error":"TypeError: test_add() missing 2 required positional arguments: 'b' and 'expected'"},{"fix":"Each test tuple must have exactly as many elements as argument names.","cause":"Number of values in a test case tuple does not match the number of argument names.","error":"ValueError: not enough values to unpack (expected x, got y)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}