Support incomplete model suffixes
This commit is contained in:
1 parent
42f8f07207
commit
6a2d912ca5
6 files changed
+113
-5
No files matched your search
@@ -177,6 +177,54 @@ def test_unknown_toolkraft_model_does_not_fall_back_to_brand_results(
|
||||
assert result.candidates == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("query", "sku"),
|
||||
[
|
||||
("Арс-12", "INS-0017"),
|
||||
("АРС12", "INS-0017"),
|
||||
("АРС-18", "INS-0018"),
|
||||
("PW-12", "INS-0010"),
|
||||
("TK-12", "INS-0024"),
|
||||
("ТР-12", "INS-0003"),
|
||||
],
|
||||
)
|
||||
def test_model_code_can_omit_only_its_final_letter(
|
||||
matcher: CatalogMatcher, query: str, sku: str
|
||||
) -> None:
|
||||
result = matcher.match(query)
|
||||
|
||||
assert result.status == "matched"
|
||||
assert [candidate.sku for candidate in result.candidates] == [sku]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"query",
|
||||
[
|
||||
"АРС-1",
|
||||
"АРС-999",
|
||||
"PW-90",
|
||||
"TK-999",
|
||||
"УШМ АРС-12",
|
||||
],
|
||||
)
|
||||
def test_partial_model_does_not_guess_numeric_or_conflicting_models(
|
||||
matcher: CatalogMatcher, query: str
|
||||
) -> None:
|
||||
result = matcher.match(query)
|
||||
|
||||
assert result.status == "not_found"
|
||||
assert result.candidates == []
|
||||
|
||||
|
||||
def test_complete_neighboring_model_keeps_exact_priority(
|
||||
matcher: CatalogMatcher,
|
||||
) -> None:
|
||||
result = matcher.match("АРС-125")
|
||||
|
||||
assert result.status == "matched"
|
||||
assert [candidate.sku for candidate in result.candidates] == ["INS-0020"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("query", ["шурпуоверт на 12в", "шураыввавёрт на 12в"])
|
||||
def test_product_type_survives_typos(matcher: CatalogMatcher, query: str) -> None:
|
||||
result = matcher.match(query)
|
||||
|
||||
Reference in new issue
Block a user