Skip to content

Commit 08260da

Browse files
committed
Add: tests for category validation
1 parent 3e12c11 commit 08260da

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

tests/unit/test_parse_categories.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from pyosmeta.parse_issues import ProcessIssues
3+
from pyosmeta.parse_issues import ProcessIssues, ReviewModel
44

55
checked = [
66
["Submitting Author", "Nabil Freij (@nabobalis)"],
@@ -65,3 +65,37 @@ def test_get_categories(
6565

6666
# Assert the result matches the expected categories
6767
assert categories == expected_categories
68+
69+
70+
@pytest.mark.parametrize(
71+
"input_categories,expected_return",
72+
[
73+
(
74+
["data-processing"],
75+
["data-processing-munging"],
76+
),
77+
(
78+
["data-processing/munging"],
79+
["data-processing-munging"],
80+
),
81+
(
82+
["scientific-software and friends"],
83+
["scientific-software-wrapper"],
84+
),
85+
(
86+
["data-validation and things -testing"],
87+
["data-validation-testing"],
88+
),
89+
(
90+
["data-processing", "data-extraction"],
91+
["data-processing-munging", "data-extraction"],
92+
),
93+
],
94+
)
95+
def test_clean_categories(
96+
input_categories: list[str], expected_return: list[str]
97+
):
98+
"""Test that ensures our pydantic model cleans categories as expected"""
99+
100+
review = ReviewModel(categories=input_categories)
101+
assert review.categories == expected_return

0 commit comments

Comments
 (0)