Skip to content

Commit b7a8d8f

Browse files
committed
Tests for ordinal behavior (#14). Currently failing.
1 parent 56e477a commit b7a8d8f

File tree

1 file changed

+51
-6
lines changed

1 file changed

+51
-6
lines changed

tests/test_ordinals.py

+51-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3-
def test_first_mark(item_names_for):
3+
4+
def test_first(item_names_for):
45
tests_content = """
56
import pytest
67
@@ -9,24 +10,69 @@ def test_1(): pass
910
@pytest.mark.first
1011
def test_2(): pass
1112
"""
12-
1313
assert item_names_for(tests_content) == ['test_2', 'test_1']
1414

1515

16-
def test_last_mark(item_names_for):
16+
def test_second(item_names_for):
17+
tests_content = """
18+
import pytest
19+
20+
def test_1(): pass
21+
def test_2(): pass
22+
def test_3(): pass
23+
def test_4(): pass
24+
25+
@pytest.mark.second
26+
def test_5(): pass
27+
"""
28+
assert item_names_for(tests_content) == ['test_1', 'test_5', 'test_2', 'test_3', 'test_4']
29+
30+
31+
def test_third(item_names_for):
32+
tests_content = """
33+
import pytest
34+
35+
def test_1(): pass
36+
def test_2(): pass
37+
def test_3(): pass
38+
39+
@pytest.mark.third
40+
def test_4(): pass
41+
42+
def test_5(): pass
43+
"""
44+
assert item_names_for(tests_content) == ['test_1', 'test_2', 'test_4', 'test_3', 'test_5']
45+
46+
47+
def test_second_to_last(item_names_for):
1748
tests_content = """
1849
import pytest
1950
20-
@pytest.mark.last
2151
def test_1(): pass
2252
53+
@pytest.mark.second_to_last
2354
def test_2(): pass
55+
56+
def test_3(): pass
57+
def test_4(): pass
58+
def test_5(): pass
2459
"""
60+
assert item_names_for(tests_content) == ['test_1', 'test_3', 'test_4', 'test_2', 'test_5']
61+
2562

63+
def test_last(item_names_for):
64+
tests_content = """
65+
import pytest
66+
67+
@pytest.mark.last
68+
def test_1(): pass
69+
70+
def test_2(): pass
71+
"""
2672
assert item_names_for(tests_content) == ['test_2', 'test_1']
2773

2874

29-
def test_first_last_marks(item_names_for):
75+
def test_first_last(item_names_for):
3076
tests_content = """
3177
import pytest
3278
@@ -38,5 +84,4 @@ def test_2(): pass
3884
3985
def test_3(): pass
4086
"""
41-
4287
assert item_names_for(tests_content) == ['test_2', 'test_3', 'test_1']

0 commit comments

Comments
 (0)