MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_parametrize_error

Method test_parametrize_error

testing/python/metafunc.py:71–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

69 assert metafunc.cls is None
70
71 def test_parametrize_error(self) -> None:
72 def func(x, y):
73 pass
74
75 metafunc = self.Metafunc(func)
76 metafunc.parametrize("x", [1, 2])
77 pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6]))
78 pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6]))
79 metafunc.parametrize("y", [1, 2])
80 pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6]))
81 pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6]))
82
83 with pytest.raises(TypeError, match="^ids must be a callable or an iterable$"):
84 metafunc.parametrize("y", [5, 6], ids=42) # type: ignore[arg-type]
85
86 def test_parametrize_error_iterator(self) -> None:
87 def func(x):

Callers

nothing calls this directly

Calls 2

MetafuncMethod · 0.95
parametrizeMethod · 0.95

Tested by

no test coverage detected