summaryrefslogtreecommitdiffstats
path: root/python/tests/import_common.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
commitcdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7 (patch)
tree5e4034027b51f3ee4d2a488bb2cbb7a75c3bd0d8 /python/tests/import_common.py
parent78f08280edea4ff65ca613ad30005c45cc48dea6 (diff)
downloadfatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.tar.gz
fatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.zip
fmt (black): tests/
Diffstat (limited to 'python/tests/import_common.py')
-rw-r--r--python/tests/import_common.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/python/tests/import_common.py b/python/tests/import_common.py
index 2b7c935a..cd89f914 100644
--- a/python/tests/import_common.py
+++ b/python/tests/import_common.py
@@ -1,4 +1,3 @@
-
import datetime
import json
from typing import Any
@@ -17,15 +16,16 @@ from fatcat_tools.transforms import entity_to_dict
@pytest.fixture(scope="function")
def entity_importer(api, mocker) -> Any:
es_client = elasticsearch.Elasticsearch("mockbackend")
- mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request')
+ mocker.patch("elasticsearch.connection.Urllib3HttpConnection.perform_request")
yield EntityImporter(api, es_client=es_client)
+
def test_fuzzy_match_none(entity_importer, mocker) -> None:
"""
Simple ES-mocked test for "no search results" case
"""
- es_raw = mocker.patch('elasticsearch.connection.Urllib3HttpConnection.perform_request')
+ es_raw = mocker.patch("elasticsearch.connection.Urllib3HttpConnection.perform_request")
es_raw.side_effect = [
(200, {}, json.dumps(ES_RELEASE_EMPTY_RESP)),
(200, {}, json.dumps(ES_RELEASE_EMPTY_RESP)),
@@ -39,6 +39,7 @@ def test_fuzzy_match_none(entity_importer, mocker) -> None:
resp = entity_importer.match_existing_release_fuzzy(release)
assert resp is None
+
def test_fuzzy_match_different(entity_importer, mocker) -> None:
"""
Simple fuzzycat-mocked test for "strong match" case
@@ -60,7 +61,7 @@ def test_fuzzy_match_different(entity_importer, mocker) -> None:
ext_ids=ReleaseExtIds(),
)
- match_raw = mocker.patch('fatcat_tools.importers.common.match_release_fuzzy')
+ match_raw = mocker.patch("fatcat_tools.importers.common.match_release_fuzzy")
match_raw.side_effect = [[r3, r2, r3, r2]]
resp = entity_importer.match_existing_release_fuzzy(r1)
assert (resp[0], resp[2]) == ("STRONG", r2)