Update tests/test_param.py
Run Pytest with HTML and XML Test Reports / tests (push) Successful in 25s

This commit is contained in:
2025-07-17 10:15:48 +02:00
parent eedae7ff5c
commit 79b5922a2b
+29 -1
View File
@@ -41,4 +41,32 @@ testdata = [
@pytest.mark.parametrize("a,b,expected", testdata)
def test_timedistance_v1(a, b, expected):
diff = a - b
assert diff == expected
assert diff == expected
scenarios = [
("one", {"x": 1, "y": 2}),
("two", {"x": 3, "y": 4}),
("edge", {"x": -1, "y": -1}),
]
def pytest_generate_tests(metafunc):
if hasattr(metafunc.cls, "scenarios"):
ids = []
argnames = []
argvalues = []
for name, param_dict in metafunc.cls.scenarios:
ids.append(name)
if not argnames:
argnames = list(param_dict.keys())
argvalues.append([param_dict[k] for k in argnames])
metafunc.parametrize(argnames, argvalues, ids=ids)
class TestDynamic:
scenarios = scenarios
def test_sum_positive(self, x, y):
assert (x + y) >= 0