summaryrefslogtreecommitdiffstats
path: root/python/tests/import_datacite.py
diff options
context:
space:
mode:
authorMartin Czygan <martin@archive.org>2020-07-06 18:53:24 +0000
committerMartin Czygan <martin@archive.org>2020-07-06 18:53:24 +0000
commit68cf95bd1d1588c0d3170b4032596756e07ae718 (patch)
tree3163a803dd6743c84c83a786b5aea7eda3bbca8e /python/tests/import_datacite.py
parentbea909f997bcef51e2624b9eea42c8fbe7115aaa (diff)
parent8583c6866f2bb89e8dfe5f5e5893048c2fd854e7 (diff)
downloadfatcat-68cf95bd1d1588c0d3170b4032596756e07ae718.tar.gz
fatcat-68cf95bd1d1588c0d3170b4032596756e07ae718.zip
Merge branch 'bnewbold-lint' into 'master'
lint cleanups See merge request webgroup/fatcat!62
Diffstat (limited to 'python/tests/import_datacite.py')
-rw-r--r--python/tests/import_datacite.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/python/tests/import_datacite.py b/python/tests/import_datacite.py
index 20c1eaf8..8fb2d079 100644
--- a/python/tests/import_datacite.py
+++ b/python/tests/import_datacite.py
@@ -2,15 +2,17 @@
Test datacite importer.
"""
-import collections
+import gzip
+import json
import datetime
+import collections
+
import pytest
-import gzip
+
from fatcat_tools.importers import DataciteImporter, JsonLinePusher
-from fatcat_tools.importers.datacite import find_original_language_title, parse_datacite_titles, parse_datacite_dates, clean_doi, index_form_to_display_name, lookup_license_slug
+from fatcat_tools.importers.datacite import find_original_language_title, parse_datacite_titles, parse_datacite_dates, index_form_to_display_name, lookup_license_slug
from fatcat_tools.transforms import entity_to_dict
-from fixtures import api
-import json
+from fixtures import *
@pytest.fixture(scope="function")
@@ -295,7 +297,7 @@ def test_datacite_conversions(datacite_importer):
re = datacite_importer.parse_record(json.load(f))
result = entity_to_dict(re)
with open(dst, 'r') as f:
- expected = json.loads(f.read())
+ expected = json.loads(f.read())
assert result == expected, 'output mismatch in {}'.format(dst)
@@ -340,20 +342,20 @@ def test_lookup_license_slug():
Case('http://onlinelibrary.wiley.com/termsAndConditions', 'WILEY'),
Case('https://publikationen.bibliothek.kit.edu/kitopen-lizenz', 'KIT-OPEN'),
Case('http://journals.sagepub.com/page/policies/text-and-data-mining-license', 'SAGE-TDM'),
- Case('https://creativecommons.org/publicdomain/mark/1.0/deed.de', 'CC-PUBLICDOMAIN'),
- Case('http://creativecommons.org/publicdomain/mark/1.0', 'CC-PUBLICDOMAIN'),
- Case('https://creativecommons.org/publicdomain/mark/1.0', 'CC-PUBLICDOMAIN'),
- Case('https://creativecommons.org/publicdomain/mark/1.0/', 'CC-PUBLICDOMAIN'),
- Case('https://creativecommons.org/publicdomain/mark/1.0/deed.de', 'CC-PUBLICDOMAIN'),
- Case('https://creativecommons.org/share-your-work/public-domain/cc0/', 'CC-0'),
- Case('http://spdx.org/licenses/CC0-1.0.json', 'CC-0'),
- Case('http://spdx.org/licenses/CC-BY-1.0.json', 'CC-BY'),
- Case('http://spdx.org/licenses/CC-BY-4.0.json', 'CC-BY'),
- Case('http://spdx.org/licenses/CC-BY-NC-4.0.json', 'CC-BY-NC'),
- Case('http://spdx.org/licenses/CC-BY-SA-3.0.json', 'CC-BY-SA'),
- Case('http://spdx.org/licenses/CC-BY-SA-4.0.json', 'CC-BY-SA'),
- Case('http://spdx.org/licenses/MIT.json', 'MIT'),
- Case('http://spdx.org/licenses/OGL-Canada-2.0.json', 'OGL-CANADA'),
+ Case('https://creativecommons.org/publicdomain/mark/1.0/deed.de', 'CC-PUBLICDOMAIN'),
+ Case('http://creativecommons.org/publicdomain/mark/1.0', 'CC-PUBLICDOMAIN'),
+ Case('https://creativecommons.org/publicdomain/mark/1.0', 'CC-PUBLICDOMAIN'),
+ Case('https://creativecommons.org/publicdomain/mark/1.0/', 'CC-PUBLICDOMAIN'),
+ Case('https://creativecommons.org/publicdomain/mark/1.0/deed.de', 'CC-PUBLICDOMAIN'),
+ Case('https://creativecommons.org/share-your-work/public-domain/cc0/', 'CC-0'),
+ Case('http://spdx.org/licenses/CC0-1.0.json', 'CC-0'),
+ Case('http://spdx.org/licenses/CC-BY-1.0.json', 'CC-BY'),
+ Case('http://spdx.org/licenses/CC-BY-4.0.json', 'CC-BY'),
+ Case('http://spdx.org/licenses/CC-BY-NC-4.0.json', 'CC-BY-NC'),
+ Case('http://spdx.org/licenses/CC-BY-SA-3.0.json', 'CC-BY-SA'),
+ Case('http://spdx.org/licenses/CC-BY-SA-4.0.json', 'CC-BY-SA'),
+ Case('http://spdx.org/licenses/MIT.json', 'MIT'),
+ Case('http://spdx.org/licenses/OGL-Canada-2.0.json', 'OGL-CANADA'),
]
for c in cases: