Skip to content

Commit 49772d6

Browse files
committed
Tests: Mark tests for expect_name_in_output kwarg with "model_dependent" so they can be filtered.
1 parent 04a870a commit 49772d6

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ packages = ["ingredient_parser", "ingredient_parser.en", "ingredient_parser.en.f
4545
version = {attr = "ingredient_parser.__version__"}
4646

4747
[tool.pytest.ini_options]
48+
markers = [
49+
"model_dependent: marks tests where the success is highly dependent on the trained model (deselect with '-m \"not model_dependent\"')",
50+
]
4851
minversion = "7.0"
4952
addopts = [
5053
"-ra",

tests/parser/test_expect_name_in_output.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
from unittest.mock import MagicMock
22

3+
import pytest
4+
35
from ingredient_parser import parse_ingredient
46
from ingredient_parser.en.parser import guess_ingredient_name
57

68

79
class Test_expect_name_in_output:
10+
@pytest.mark.model_dependent
811
def test_enabled(self):
912
"""
1013
Test that the return name is not []
1114
"""
12-
sentence = "1 can (14 fluid ounces, or 425 ml) coconut milk"
15+
sentence = "1 cup, plus 2 tablespoons olive oil"
1316
parsed = parse_ingredient(sentence, expect_name_in_output=True)
1417
assert parsed.name != []
1518

19+
@pytest.mark.model_dependent
1620
def test_disabled(self):
1721
"""
1822
Test that the returned name is []
1923
"""
20-
sentence = "1 can (14 fluid ounces, or 425 ml) coconut milk"
24+
sentence = "1 cup, plus 2 tablespoons olive oil"
2125
parsed = parse_ingredient(sentence, expect_name_in_output=False)
2226
assert parsed.name == []
2327

28+
@pytest.mark.model_dependent
2429
def test_disabled_name_not_separate(self):
2530
"""
2631
Test that the returned name is [] when not separating names
2732
"""
28-
sentence = "1 can (14 fluid ounces, or 425 ml) coconut milk"
33+
sentence = "1 cup, plus 2 tablespoons olive oil"
2934
parsed = parse_ingredient(
3035
sentence, expect_name_in_output=False, separate_names=False
3136
)
3237
assert parsed.name == []
3338

39+
@pytest.mark.model_dependent
3440
def test_enabled_but_no_name(self):
3541
"""
3642
Test that the return name is None even though guess_name_fallback is enabled.

0 commit comments

Comments
 (0)