Skip to content

Commit 068257d

Browse files
author
Sylvain MARIE
committed
Added test corresponding to issue #154 but lower level (@parametrize)
1 parent 2f6d4ab commit 068257d

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

pytest_cases/tests/pytest_extension/parametrize_plus/test_fixture_ref_basic4_ids.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
55
import pytest
66

7-
from pytest_cases import parametrize_plus, pytest_fixture_plus, fixture_ref
7+
from pytest_cases import parametrize, pytest_fixture_plus, fixture_ref
88

99

1010
@pytest.fixture
@@ -18,23 +18,40 @@ def b(arg):
1818
return "B%s" % arg
1919

2020

21-
@parametrize_plus("arg1,arg2", [('1', None),
22-
(None, '2'),
23-
fixture_ref('a'),
24-
('4', '4'),
25-
('3', fixture_ref('b'))
26-
])
21+
argvalues = [
22+
('1', None),
23+
(None, '2'),
24+
fixture_ref('a'),
25+
fixture_ref('a', id="aaa"),
26+
('4', '4'),
27+
('1', fixture_ref('a')),
28+
('3', fixture_ref('b'))
29+
]
30+
31+
32+
@parametrize("arg1,arg2", argvalues)
2733
def test_foo(arg1, arg2):
2834
print(arg1, arg2)
2935

3036

37+
@parametrize("arg1,arg2", argvalues, idstyle='compact')
38+
def test_foo_compact(arg1, arg2):
39+
print(arg1, arg2)
40+
41+
42+
@parametrize("arg1,arg2", argvalues, idstyle=None)
43+
def test_foo_nostyle(arg1, arg2):
44+
print(arg1, arg2)
45+
46+
3147
def test_synthesis(module_results_dct):
3248
"""See https://github.com/smarie/python-pytest-cases/issues/86"""
3349
assert list(module_results_dct) == [
3450
'test_foo[arg1_arg2_is_P0toP1-1-None]',
3551
'test_foo[arg1_arg2_is_P0toP1-None-2]',
3652
'test_foo[arg1_arg2_is_a]',
53+
'test_foo[arg1_arg2_is_aaa]',
3754
'test_foo[arg1_arg2_is_4-4]',
38-
'test_foo[arg1_arg2_is_P4-1]',
39-
'test_foo[arg1_arg2_is_P4-2]'
55+
'test_foo[arg1_arg2_is_P5-1]',
56+
'test_foo[arg1_arg2_is_P5-2]'
4057
]

0 commit comments

Comments
 (0)