Skip to content

Commit 228b6db

Browse files
committed
Infra: deduplicate test with parametrize
1 parent 4c587dd commit 228b6db

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

pep_sphinx_extensions/tests/pep_zero_generator/test_parser.py

+10-15
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,21 @@ def test_pep_equal():
2828
assert pep_a == pep_b
2929

3030

31-
def test_pep_details():
32-
pep8 = parser.PEP(Path("pep-0008.txt"), AUTHORS_OVERRIDES)
33-
34-
assert pep8.details(title_length=80) == {
35-
"authors": "GvR, Warsaw, Coghlan",
36-
"number": 8,
37-
"status": " ",
38-
"title": "Style Guide for Python Code",
39-
"type": "P",
40-
}
41-
42-
43-
def test_pep_details_short_title():
31+
@pytest.mark.parametrize(
32+
"test_input, expected",
33+
[
34+
(80, "Style Guide for Python Code"),
35+
(10, "Style ..."),
36+
],
37+
)
38+
def test_pep_details(test_input, expected):
4439
pep8 = parser.PEP(Path("pep-0008.txt"), AUTHORS_OVERRIDES)
4540

46-
assert pep8.details(title_length=10) == {
41+
assert pep8.details(title_length=test_input) == {
4742
"authors": "GvR, Warsaw, Coghlan",
4843
"number": 8,
4944
"status": " ",
50-
"title": "Style ...",
45+
"title": expected,
5146
"type": "P",
5247
}
5348

0 commit comments

Comments
 (0)