diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-12-17 10:07:15 +0100 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-12-21 20:56:56 +0100 |
commit | de9f1155ea57c812171abd5517ab39f4fe135cb3 (patch) | |
tree | 2b2071642259c46ede5b56d15cbce15187226362 /tests | |
parent | 4720fb51584fae1edc2a79dd94c24b4ddac92acb (diff) | |
download | fuzzycat-master.tar.gz fuzzycat-master.zip |
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files/fuzzy_release_matcher/0.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/1.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/2.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/3.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/4.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/5.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/6.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/7.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/8.yaml | 1 | ||||
-rw-r--r-- | tests/files/fuzzy_release_matcher/9.yaml | 1 | ||||
-rw-r--r-- | tests/test_matching.py | 7 |
11 files changed, 14 insertions, 3 deletions
diff --git a/tests/files/fuzzy_release_matcher/0.yaml b/tests/files/fuzzy_release_matcher/0.yaml index 71fc992..3c0b915 100644 --- a/tests/files/fuzzy_release_matcher/0.yaml +++ b/tests/files/fuzzy_release_matcher/0.yaml @@ -10,6 +10,7 @@ input: > "ext_ids": {} } release_year_padding: 1 +skip_id_matching: false expected: - 7rmvqtrb2jdyhcxxodihzzcugy - upm5nljirrbsfenoyxsisciltq diff --git a/tests/files/fuzzy_release_matcher/1.yaml b/tests/files/fuzzy_release_matcher/1.yaml index df6a954..115111b 100644 --- a/tests/files/fuzzy_release_matcher/1.yaml +++ b/tests/files/fuzzy_release_matcher/1.yaml @@ -10,6 +10,7 @@ input: > "ext_ids": {} } release_year_padding: 1 +skip_id_matching: false expected: - 7rmvqtrb2jdyhcxxodihzzcugy - a2u6ougtsjcbvczou6sazsulcm diff --git a/tests/files/fuzzy_release_matcher/2.yaml b/tests/files/fuzzy_release_matcher/2.yaml index df6a954..115111b 100644 --- a/tests/files/fuzzy_release_matcher/2.yaml +++ b/tests/files/fuzzy_release_matcher/2.yaml @@ -10,6 +10,7 @@ input: > "ext_ids": {} } release_year_padding: 1 +skip_id_matching: false expected: - 7rmvqtrb2jdyhcxxodihzzcugy - a2u6ougtsjcbvczou6sazsulcm diff --git a/tests/files/fuzzy_release_matcher/3.yaml b/tests/files/fuzzy_release_matcher/3.yaml index 1ab761b..ed56d5a 100644 --- a/tests/files/fuzzy_release_matcher/3.yaml +++ b/tests/files/fuzzy_release_matcher/3.yaml @@ -5,6 +5,7 @@ input: > "ext_ids": {} } release_year_padding: 0 +skip_id_matching: false expected: - '2f57funqizf4lcxjanls45upom' - '3p2hngx6kfa33bdaobipimdzhe' diff --git a/tests/files/fuzzy_release_matcher/4.yaml b/tests/files/fuzzy_release_matcher/4.yaml index 9419406..899772b 100644 --- a/tests/files/fuzzy_release_matcher/4.yaml +++ b/tests/files/fuzzy_release_matcher/4.yaml @@ -6,6 +6,7 @@ input: > "ext_ids": {} } release_year_padding: 0 +skip_id_matching: false expected: - '66r4s55dpvht5jghwkhupai2km' - 'ccoocm7uzjgwnlpfk5fbwfudjm' diff --git a/tests/files/fuzzy_release_matcher/5.yaml b/tests/files/fuzzy_release_matcher/5.yaml index 1eb435b..d8f208a 100644 --- a/tests/files/fuzzy_release_matcher/5.yaml +++ b/tests/files/fuzzy_release_matcher/5.yaml @@ -10,6 +10,7 @@ input: > "ext_ids": {} } release_year_padding: 1 +skip_id_matching: false expected: - 'xfhjsixnlvbibigrilisqqvfk4' - 'zfhfpo2shrdexpgd2as4fz7wnm' diff --git a/tests/files/fuzzy_release_matcher/6.yaml b/tests/files/fuzzy_release_matcher/6.yaml index ae52b23..7841b68 100644 --- a/tests/files/fuzzy_release_matcher/6.yaml +++ b/tests/files/fuzzy_release_matcher/6.yaml @@ -10,6 +10,7 @@ input: > "ext_ids": {} } release_year_padding: 0 +skip_id_matching: false expected: - 2bbtr4cltbgannqc6vqijvvzdq - 34i2hba6tzf3xomobhumfkkvga diff --git a/tests/files/fuzzy_release_matcher/7.yaml b/tests/files/fuzzy_release_matcher/7.yaml index 2330f0d..7affb8f 100644 --- a/tests/files/fuzzy_release_matcher/7.yaml +++ b/tests/files/fuzzy_release_matcher/7.yaml @@ -5,6 +5,7 @@ input: > "ext_ids": {} } release_year_padding: 1 +skip_id_matching: false expected: - yvqtz2zvkzcbpj4jxrp7bvydfu - lttg27o7mjganpkhrgy3xyv7vu diff --git a/tests/files/fuzzy_release_matcher/8.yaml b/tests/files/fuzzy_release_matcher/8.yaml index b43e53a..271d1a4 100644 --- a/tests/files/fuzzy_release_matcher/8.yaml +++ b/tests/files/fuzzy_release_matcher/8.yaml @@ -134,6 +134,7 @@ input: > } } release_year_padding: 1 +skip_id_matching: true expected: - yvqtz2zvkzcbpj4jxrp7bvydfu - lttg27o7mjganpkhrgy3xyv7vu diff --git a/tests/files/fuzzy_release_matcher/9.yaml b/tests/files/fuzzy_release_matcher/9.yaml index b43e53a..271d1a4 100644 --- a/tests/files/fuzzy_release_matcher/9.yaml +++ b/tests/files/fuzzy_release_matcher/9.yaml @@ -134,6 +134,7 @@ input: > } } release_year_padding: 1 +skip_id_matching: true expected: - yvqtz2zvkzcbpj4jxrp7bvydfu - lttg27o7mjganpkhrgy3xyv7vu diff --git a/tests/test_matching.py b/tests/test_matching.py index eb54751..a8f8f5b 100644 --- a/tests/test_matching.py +++ b/tests/test_matching.py @@ -29,8 +29,7 @@ logger.setLevel(logging.DEBUG) FATCAT_SEARCH_URL = settings.get("FATCAT_SEARCH_URL", "https://search.fatcat.wiki:443") -def yaml_to_cases(klass, - files="tests/files/fuzzy_release_match_release_exact_title_exact_contrib/*.yaml"): +def yaml_to_cases(klass, files="tests/files/fuzzy_release_matcher/*.yaml"): """ Turn yaml files into a collection of named tuple test cases. The glob is relative to the project root (i.e. where you usually run `pytest` from). @@ -54,10 +53,12 @@ def test_simple_fuzzy_release_matcher(es_client, caplog): the result to be sensible, but should also document broken examples here. """ matcher = FuzzyReleaseMatcher(es=es_client) - Case = collections.namedtuple("Case", "about input release_year_padding expected") + Case = collections.namedtuple( + "Case", ["about", "input", "skip_id_matching", "release_year_padding", "expected"]) cases = yaml_to_cases(Case, "tests/files/fuzzy_release_matcher/*.yaml") for i, c in enumerate(cases): matcher.release_year_padding = c.release_year_padding + matcher.skip_id_matching = c.skip_id_matching entity = entity_from_json(c.input, ReleaseEntity) result = matcher.match(entity) assert set([r.ident for r in result]) == set(c.expected), "[{}] {}".format(c.about, c.input) |