Skip to content

Commit 202dcf0

Browse files
author
Sylvain MARIE
committed
Fixed tests now that classmethods and staticmethods work
1 parent bfe2c2f commit 202dcf0

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

pytest_cases/tests/cases/doc/cases_doc_alternate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ def two_positive_ints():
1616
class CasesFoo:
1717
@classmethod
1818
def case_toto(cls):
19-
return
19+
return 0, 0
2020

2121
@staticmethod
2222
def case_foo():
23-
return
23+
return 0, 0
2424

2525
@case(id="hello")
2626
def case_blah(self):

pytest_cases/tests/cases/doc/test_doc.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def test_foo_fun_list_synthesis(request):
7575
class CasesFoo:
7676
@classmethod
7777
def case_toto(cls):
78-
return
78+
return 0, 0
7979

8080
@staticmethod
8181
def case_foo():
82-
return
82+
return 0, 0
8383

8484
@pytest.mark.skipif(False, reason="no")
8585
@case(id="hello world")
@@ -106,11 +106,15 @@ def test_foo_cls_synthesis(request):
106106
results_dct = get_session_synthesis_dct(request, filter=test_foo_cls, test_id_format='function')
107107
if has_pytest_param:
108108
assert list(results_dct) == [
109+
'test_foo_cls[toto]',
110+
'test_foo_cls[foo]',
109111
'test_foo_cls[hello world]',
110112
'test_foo_cls[two_negative_ints]'
111113
]
112114
else:
113115
assert list(results_dct) == [
116+
'test_foo_cls[toto[0]-toto[1]]',
117+
'test_foo_cls[foo[0]-foo[1]]',
114118
'test_foo_cls[hello world[0]-hello world[1]]',
115119
'test_foo_cls[two_negative_ints[0]-two_negative_ints[1]]'
116120
]
@@ -125,15 +129,21 @@ def test_foo_cls_list_synthesis(request):
125129
results_dct = get_session_synthesis_dct(request, filter=test_foo_cls_list, test_id_format='function')
126130
ref_list = [
127131
# CasesFoo
132+
'test_foo_cls_list[toto0]',
133+
'test_foo_cls_list[foo0]',
128134
'test_foo_cls_list[hello world0]',
129135
'test_foo_cls_list[two_negative_ints0]',
130136
# strange_ints
131137
'test_foo_cls_list[strange_ints]',
132138
# cases_doc_alternate.py
139+
'test_foo_cls_list[toto1]',
140+
'test_foo_cls_list[foo1]',
133141
'test_foo_cls_list[hello]',
134142
'test_foo_cls_list[two_negative_ints1]',
135143
'test_foo_cls_list[two_negative_ints2]',
136144
# CasesFoo
145+
'test_foo_cls_list[toto2]',
146+
'test_foo_cls_list[foo2]',
137147
'test_foo_cls_list[hello world1]',
138148
'test_foo_cls_list[two_negative_ints3]',
139149
# test_doc_cases.py

pytest_cases/tests/cases/doc/test_doc_alternate.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ def test_foo_alternate_cases_file_and_two_marked_skip_synthesis(request):
2121
test_id_format='function')
2222
if has_pytest_param:
2323
assert list(results_dct) == [
24+
'test_foo_alternate_cases_file_and_two_marked_skip[toto]',
25+
'test_foo_alternate_cases_file_and_two_marked_skip[foo]',
2426
'test_foo_alternate_cases_file_and_two_marked_skip[hello]',
2527
'test_foo_alternate_cases_file_and_two_marked_skip[two_negative_ints0]',
2628
'test_foo_alternate_cases_file_and_two_marked_skip[two_negative_ints1]'
2729
]
2830
else:
2931
assert list(results_dct) == [
30-
'test_foo_alternate_cases_file_and_two_marked_skip[0hello[0]-hello[1]]',
31-
'test_foo_alternate_cases_file_and_two_marked_skip[2two_negative_ints[0]-two_negative_ints[1]]',
32-
'test_foo_alternate_cases_file_and_two_marked_skip[4two_negative_ints[0]-two_negative_ints[1]]'
32+
'test_foo_alternate_cases_file_and_two_marked_skip[0toto[0]-toto[1]]',
33+
'test_foo_alternate_cases_file_and_two_marked_skip[1foo[0]-foo[1]]',
34+
'test_foo_alternate_cases_file_and_two_marked_skip[2hello[0]-hello[1]]',
35+
'test_foo_alternate_cases_file_and_two_marked_skip[4two_negative_ints[0]-two_negative_ints[1]]',
36+
'test_foo_alternate_cases_file_and_two_marked_skip[6two_negative_ints[0]-two_negative_ints[1]]'
3337
]

0 commit comments

Comments
 (0)