aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:05:23 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:05:23 -0700
commit78f08280edea4ff65ca613ad30005c45cc48dea6 (patch)
tree6cb0408dde68f4ca8093fef18956c85f58882ccf /python/tests
parent46b4f588b2e58fe5d2d4b1a885c095f24c6cd400 (diff)
downloadfatcat-78f08280edea4ff65ca613ad30005c45cc48dea6.tar.gz
fatcat-78f08280edea4ff65ca613ad30005c45cc48dea6.zip
python: isort everything
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/api_editgroups.py2
-rw-r--r--python/tests/api_editor.py4
-rw-r--r--python/tests/api_entity_editing.py1
-rw-r--r--python/tests/api_entity_state.py1
-rw-r--r--python/tests/api_releases.py2
-rw-r--r--python/tests/api_webcaptures.py2
-rw-r--r--python/tests/clean_files.py5
-rw-r--r--python/tests/fixtures.py7
-rw-r--r--python/tests/harvest_crossref.py4
-rw-r--r--python/tests/harvest_datacite.py4
-rw-r--r--python/tests/harvest_pubmed.py3
-rw-r--r--python/tests/harvest_state.py1
-rw-r--r--python/tests/import_arabesque.py5
-rw-r--r--python/tests/import_arxiv.py2
-rw-r--r--python/tests/import_common.py8
-rw-r--r--python/tests/import_crossref.py6
-rw-r--r--python/tests/import_datacite.py17
-rw-r--r--python/tests/import_dblp.py10
-rw-r--r--python/tests/import_doaj.py6
-rw-r--r--python/tests/import_file_generic.py2
-rw-r--r--python/tests/import_file_meta.py5
-rw-r--r--python/tests/import_fileset_generic.py3
-rw-r--r--python/tests/import_grobid_metadata.py7
-rw-r--r--python/tests/import_ingest.py9
-rw-r--r--python/tests/import_jalc.py4
-rw-r--r--python/tests/import_journal_metadata.py2
-rw-r--r--python/tests/import_jstor.py4
-rw-r--r--python/tests/import_matched.py5
-rw-r--r--python/tests/import_orcid.py5
-rw-r--r--python/tests/import_pubmed.py4
-rw-r--r--python/tests/import_shadow.py5
-rw-r--r--python/tests/importer.py3
-rw-r--r--python/tests/tools_api.py2
-rw-r--r--python/tests/transform_ingest.py3
-rw-r--r--python/tests/web_citation_csl.py1
-rw-r--r--python/tests/web_coverage.py4
-rw-r--r--python/tests/web_entity_views.py3
-rw-r--r--python/tests/web_refs.py5
-rw-r--r--python/tests/web_search.py5
39 files changed, 98 insertions, 73 deletions
diff --git a/python/tests/api_editgroups.py b/python/tests/api_editgroups.py
index b4420b29..9f870fb1 100644
--- a/python/tests/api_editgroups.py
+++ b/python/tests/api_editgroups.py
@@ -1,7 +1,7 @@
-import pytest
import datetime
+import pytest
from fatcat_openapi_client import *
from fixtures import *
diff --git a/python/tests/api_editor.py b/python/tests/api_editor.py
index ab118501..0c680a2f 100644
--- a/python/tests/api_editor.py
+++ b/python/tests/api_editor.py
@@ -1,8 +1,6 @@
-import pytest
-
import fatcat_openapi_client
-
+import pytest
from fixtures import api
diff --git a/python/tests/api_entity_editing.py b/python/tests/api_entity_editing.py
index fee4e34f..5f22e9f2 100644
--- a/python/tests/api_entity_editing.py
+++ b/python/tests/api_entity_editing.py
@@ -1,6 +1,5 @@
import pytest
-
from fatcat_openapi_client import *
from fixtures import *
diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py
index 4b49083e..58e1d42b 100644
--- a/python/tests/api_entity_state.py
+++ b/python/tests/api_entity_state.py
@@ -1,6 +1,5 @@
import pytest
-
from fatcat_openapi_client import *
from fatcat_openapi_client.rest import ApiException
from fixtures import *
diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py
index 4437b57b..a823d4cd 100644
--- a/python/tests/api_releases.py
+++ b/python/tests/api_releases.py
@@ -1,7 +1,7 @@
-import pytest
import datetime
+import pytest
from fatcat_openapi_client import *
from fixtures import *
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 85813218..510d398c 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -1,7 +1,7 @@
-import pytest
import datetime
+import pytest
from fatcat_openapi_client import *
from fixtures import *
diff --git a/python/tests/clean_files.py b/python/tests/clean_files.py
index f752bc2c..c8b935bb 100644
--- a/python/tests/clean_files.py
+++ b/python/tests/clean_files.py
@@ -1,11 +1,12 @@
import copy
-import pytest
-from fatcat_tools.cleanups import FileCleaner
+import pytest
from fatcat_openapi_client import *
from fixtures import *
+from fatcat_tools.cleanups import FileCleaner
+
@pytest.fixture(scope="function")
def file_cleaner(api):
diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py
index e0bb1aae..a9b81bda 100644
--- a/python/tests/fixtures.py
+++ b/python/tests/fixtures.py
@@ -1,14 +1,13 @@
+import elasticsearch
+import fatcat_openapi_client
import pytest
from dotenv import load_dotenv
-import elasticsearch
+from fatcat_openapi_client import *
import fatcat_web
-import fatcat_openapi_client
-from fatcat_openapi_client import *
from fatcat_tools import authenticated_api
-
ES_CONTAINER_STATS_RESP = {
'timed_out': False,
'aggregations': {
diff --git a/python/tests/harvest_crossref.py b/python/tests/harvest_crossref.py
index cad0f03b..fb43e3f6 100644
--- a/python/tests/harvest_crossref.py
+++ b/python/tests/harvest_crossref.py
@@ -1,7 +1,9 @@
-import json
import datetime
+import json
+
import responses
+
from fatcat_tools.harvest import *
diff --git a/python/tests/harvest_datacite.py b/python/tests/harvest_datacite.py
index 13c6042a..0a7584bd 100644
--- a/python/tests/harvest_datacite.py
+++ b/python/tests/harvest_datacite.py
@@ -1,7 +1,9 @@
-import json
import datetime
+import json
+
import responses
+
from fatcat_tools.harvest import *
diff --git a/python/tests/harvest_pubmed.py b/python/tests/harvest_pubmed.py
index 58bc4226..aba766ba 100644
--- a/python/tests/harvest_pubmed.py
+++ b/python/tests/harvest_pubmed.py
@@ -2,8 +2,9 @@
Test pubmed FTP harvest.
"""
-import os
import datetime
+import os
+
import pytest
from fatcat_tools.harvest import *
diff --git a/python/tests/harvest_state.py b/python/tests/harvest_state.py
index cc624d97..ecd276ed 100644
--- a/python/tests/harvest_state.py
+++ b/python/tests/harvest_state.py
@@ -1,5 +1,6 @@
import datetime
+
from fatcat_tools.harvest import *
diff --git a/python/tests/import_arabesque.py b/python/tests/import_arabesque.py
index 20cde3a6..6f73d817 100644
--- a/python/tests/import_arabesque.py
+++ b/python/tests/import_arabesque.py
@@ -1,10 +1,11 @@
import json
-import pytest
-from fatcat_tools.importers import ArabesqueMatchImporter, SqlitePusher, JsonLinePusher
+import pytest
from fixtures import *
+from fatcat_tools.importers import ArabesqueMatchImporter, JsonLinePusher, SqlitePusher
+
@pytest.fixture(scope="function")
def arabesque_importer(api):
diff --git a/python/tests/import_arxiv.py b/python/tests/import_arxiv.py
index 3ed1ab29..9368fb06 100644
--- a/python/tests/import_arxiv.py
+++ b/python/tests/import_arxiv.py
@@ -1,9 +1,9 @@
import pytest
from bs4 import BeautifulSoup
+from fixtures import *
from fatcat_tools.importers import ArxivRawImporter, Bs4XmlFilePusher
-from fixtures import *
@pytest.fixture(scope="function")
diff --git a/python/tests/import_common.py b/python/tests/import_common.py
index 69e51432..2b7c935a 100644
--- a/python/tests/import_common.py
+++ b/python/tests/import_common.py
@@ -1,17 +1,17 @@
-import json
import datetime
+import json
from typing import Any
-import pytest
import elasticsearch
import fatcat_openapi_client
-from fatcat_openapi_client import ReleaseEntity, ReleaseExtIds
import fuzzycat.matching
+import pytest
+from fatcat_openapi_client import ReleaseEntity, ReleaseExtIds
+from fixtures import *
from fatcat_tools.importers import EntityImporter
from fatcat_tools.transforms import entity_to_dict
-from fixtures import *
@pytest.fixture(scope="function")
diff --git a/python/tests/import_crossref.py b/python/tests/import_crossref.py
index a2c8681b..a8a1ec44 100644
--- a/python/tests/import_crossref.py
+++ b/python/tests/import_crossref.py
@@ -1,12 +1,12 @@
-import json
import gzip
+import json
+
import pytest
+from fixtures import api
from fatcat_tools.importers import CrossrefImporter, JsonLinePusher
-from fixtures import api
-
@pytest.fixture(scope="function")
def crossref_importer(api):
diff --git a/python/tests/import_datacite.py b/python/tests/import_datacite.py
index a92a732d..e1c79bc4 100644
--- a/python/tests/import_datacite.py
+++ b/python/tests/import_datacite.py
@@ -2,27 +2,26 @@
Test datacite importer.
"""
+import collections
+import datetime
import gzip
import json
-import datetime
-import collections
+import fatcat_openapi_client
import pytest
+from fixtures import api
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,
+ contributor_list_contains_contributor,
+ find_original_language_title,
index_form_to_display_name,
lookup_license_slug,
- contributor_list_contains_contributor,
+ parse_datacite_dates,
+ parse_datacite_titles,
)
from fatcat_tools.transforms import entity_to_dict
-import fatcat_openapi_client
-from fixtures import api
-import json
@pytest.fixture(scope="function")
diff --git a/python/tests/import_dblp.py b/python/tests/import_dblp.py
index 13a52247..4fb178b8 100644
--- a/python/tests/import_dblp.py
+++ b/python/tests/import_dblp.py
@@ -1,11 +1,17 @@
import io
+
import pytest
from bs4 import BeautifulSoup
-
-from fatcat_tools.importers import DblpReleaseImporter, DblpContainerImporter, Bs4XmlLargeFilePusher, JsonLinePusher
from fixtures import *
+from fatcat_tools.importers import (
+ Bs4XmlLargeFilePusher,
+ DblpContainerImporter,
+ DblpReleaseImporter,
+ JsonLinePusher,
+)
+
@pytest.fixture(scope="function")
def dblp_importer(api):
diff --git a/python/tests/import_doaj.py b/python/tests/import_doaj.py
index 72a3acb8..4cd3b518 100644
--- a/python/tests/import_doaj.py
+++ b/python/tests/import_doaj.py
@@ -1,14 +1,14 @@
-import json
import datetime
+import json
-import pytest
import elasticsearch
import fatcat_openapi_client
+import pytest
+from fixtures import *
from fatcat_tools.importers import DoajArticleImporter, JsonLinePusher
from fatcat_tools.transforms import entity_to_dict
-from fixtures import *
@pytest.fixture(scope="function")
diff --git a/python/tests/import_file_generic.py b/python/tests/import_file_generic.py
index cef82777..e1d987e8 100644
--- a/python/tests/import_file_generic.py
+++ b/python/tests/import_file_generic.py
@@ -1,8 +1,8 @@
import pytest
+from fatcat_openapi_client import *
from fatcat_tools.importers.common import EntityImporter
-from fatcat_openapi_client import *
def test_file_update_generic():
diff --git a/python/tests/import_file_meta.py b/python/tests/import_file_meta.py
index e6d1a59f..949a1075 100644
--- a/python/tests/import_file_meta.py
+++ b/python/tests/import_file_meta.py
@@ -1,11 +1,12 @@
import json
-import pytest
-from fatcat_tools.importers import FileMetaImporter, JsonLinePusher
+import pytest
from fatcat_openapi_client import FileEntity
from fixtures import *
+from fatcat_tools.importers import FileMetaImporter, JsonLinePusher
+
@pytest.fixture(scope="function")
def file_meta_importer(api):
diff --git a/python/tests/import_fileset_generic.py b/python/tests/import_fileset_generic.py
index 44310304..8d30a83b 100644
--- a/python/tests/import_fileset_generic.py
+++ b/python/tests/import_fileset_generic.py
@@ -1,9 +1,10 @@
import json
+
import pytest
+from fixtures import *
from fatcat_tools.importers import FilesetImporter, JsonLinePusher
-from fixtures import *
@pytest.fixture(scope="function")
diff --git a/python/tests/import_grobid_metadata.py b/python/tests/import_grobid_metadata.py
index 87cb8ef0..862b310f 100644
--- a/python/tests/import_grobid_metadata.py
+++ b/python/tests/import_grobid_metadata.py
@@ -1,11 +1,12 @@
-import os
-import json
import base64
+import json
+import os
+
import pytest
+from fixtures import *
from fatcat_tools.importers import GrobidMetadataImporter, LinePusher
-from fixtures import *
"""
WARNING: these tests are currently very fragile because they have database
diff --git a/python/tests/import_ingest.py b/python/tests/import_ingest.py
index 955c97cb..04a8e7f6 100644
--- a/python/tests/import_ingest.py
+++ b/python/tests/import_ingest.py
@@ -1,10 +1,15 @@
import json
-import pytest
-from fatcat_tools.importers import IngestFileResultImporter, IngestWebResultImporter, JsonLinePusher
+import pytest
from fixtures import *
+from fatcat_tools.importers import (
+ IngestFileResultImporter,
+ IngestWebResultImporter,
+ JsonLinePusher,
+)
+
@pytest.fixture(scope="function")
def ingest_importer(api):
diff --git a/python/tests/import_jalc.py b/python/tests/import_jalc.py
index 010dfce8..c11e2307 100644
--- a/python/tests/import_jalc.py
+++ b/python/tests/import_jalc.py
@@ -1,10 +1,10 @@
import pytest
from bs4 import BeautifulSoup
-
-from fatcat_tools.importers import JalcImporter, Bs4XmlFilePusher, Bs4XmlLinesPusher
from fixtures import *
+from fatcat_tools.importers import Bs4XmlFilePusher, Bs4XmlLinesPusher, JalcImporter
+
@pytest.fixture(scope="function")
def jalc_importer(api):
diff --git a/python/tests/import_journal_metadata.py b/python/tests/import_journal_metadata.py
index 51b0a78a..cdf4e8ed 100644
--- a/python/tests/import_journal_metadata.py
+++ b/python/tests/import_journal_metadata.py
@@ -1,8 +1,8 @@
import pytest
+from fixtures import *
from fatcat_tools.importers import JournalMetadataImporter, JsonLinePusher
-from fixtures import *
@pytest.fixture(scope="function")
diff --git a/python/tests/import_jstor.py b/python/tests/import_jstor.py
index 25a904a0..270da3ec 100644
--- a/python/tests/import_jstor.py
+++ b/python/tests/import_jstor.py
@@ -1,10 +1,10 @@
import pytest
from bs4 import BeautifulSoup
-
-from fatcat_tools.importers import JstorImporter, Bs4XmlFilePusher
from fixtures import *
+from fatcat_tools.importers import Bs4XmlFilePusher, JstorImporter
+
@pytest.fixture(scope="function")
def jstor_importer(api):
diff --git a/python/tests/import_matched.py b/python/tests/import_matched.py
index 6b61c53c..aad8e799 100644
--- a/python/tests/import_matched.py
+++ b/python/tests/import_matched.py
@@ -1,10 +1,11 @@
import json
-import pytest
-from fatcat_tools.importers import MatchedImporter, JsonLinePusher
+import pytest
from fixtures import *
+from fatcat_tools.importers import JsonLinePusher, MatchedImporter
+
@pytest.fixture(scope="function")
def matched_importer(api):
diff --git a/python/tests/import_orcid.py b/python/tests/import_orcid.py
index f78ccde7..88a4b871 100644
--- a/python/tests/import_orcid.py
+++ b/python/tests/import_orcid.py
@@ -1,10 +1,11 @@
import json
-import pytest
-from fatcat_tools.importers import OrcidImporter, JsonLinePusher
+import pytest
from fixtures import *
+from fatcat_tools.importers import JsonLinePusher, OrcidImporter
+
@pytest.fixture(scope="function")
def orcid_importer(api):
diff --git a/python/tests/import_pubmed.py b/python/tests/import_pubmed.py
index 8b5ff3e5..371c59bb 100644
--- a/python/tests/import_pubmed.py
+++ b/python/tests/import_pubmed.py
@@ -1,10 +1,10 @@
import pytest
from bs4 import BeautifulSoup
-
-from fatcat_tools.importers import PubmedImporter, Bs4XmlLargeFilePusher
from fixtures import *
+from fatcat_tools.importers import Bs4XmlLargeFilePusher, PubmedImporter
+
@pytest.fixture(scope="function")
def pubmed_importer(api):
diff --git a/python/tests/import_shadow.py b/python/tests/import_shadow.py
index 40a1d589..1caaf780 100644
--- a/python/tests/import_shadow.py
+++ b/python/tests/import_shadow.py
@@ -1,10 +1,11 @@
import json
-import pytest
-from fatcat_tools.importers import ShadowLibraryImporter, JsonLinePusher
+import pytest
from fixtures import *
+from fatcat_tools.importers import JsonLinePusher, ShadowLibraryImporter
+
@pytest.fixture(scope="function")
def shadow_importer(api):
diff --git a/python/tests/importer.py b/python/tests/importer.py
index 40bd8cba..1f0e942f 100644
--- a/python/tests/importer.py
+++ b/python/tests/importer.py
@@ -1,7 +1,8 @@
-from fatcat_tools.importers import CrossrefImporter, OrcidImporter
from fixtures import *
+from fatcat_tools.importers import CrossrefImporter, OrcidImporter
+
def test_issnl_mapping_lookup(api):
with open('tests/files/ISSN-to-ISSN-L.snip.txt', 'r') as issn_file:
diff --git a/python/tests/tools_api.py b/python/tests/tools_api.py
index a4b5f2ea..6d514210 100644
--- a/python/tests/tools_api.py
+++ b/python/tests/tools_api.py
@@ -2,7 +2,7 @@
import pytest
from fatcat_openapi_client.rest import ApiException
-from fatcat_tools import public_api, authenticated_api
+from fatcat_tools import authenticated_api, public_api
def test_authenticated_api():
diff --git a/python/tests/transform_ingest.py b/python/tests/transform_ingest.py
index a61aa4a7..6a358c8e 100644
--- a/python/tests/transform_ingest.py
+++ b/python/tests/transform_ingest.py
@@ -1,11 +1,12 @@
import json
-from fatcat_tools.transforms import release_ingest_request
from fatcat_openapi_client import *
from fixtures import api
from import_crossref import crossref_importer
+from fatcat_tools.transforms import release_ingest_request
+
def test_basic_ingest_release(crossref_importer):
with open('tests/files/crossref-works.single.json', 'r') as f:
diff --git a/python/tests/web_citation_csl.py b/python/tests/web_citation_csl.py
index a72742cb..508600e7 100644
--- a/python/tests/web_citation_csl.py
+++ b/python/tests/web_citation_csl.py
@@ -1,5 +1,6 @@
import json
+
import pytest
from fixtures import *
diff --git a/python/tests/web_coverage.py b/python/tests/web_coverage.py
index 47123686..0dbf3df8 100644
--- a/python/tests/web_coverage.py
+++ b/python/tests/web_coverage.py
@@ -1,8 +1,8 @@
-import json
-import pytest
import datetime
+import json
+import pytest
from fatcat_openapi_client.rest import ApiException
from fixtures import *
diff --git a/python/tests/web_entity_views.py b/python/tests/web_entity_views.py
index 45fd3e9a..0d51f87e 100644
--- a/python/tests/web_entity_views.py
+++ b/python/tests/web_entity_views.py
@@ -1,8 +1,9 @@
import json
+
from fixtures import *
-from fatcat_web.forms import ReleaseEntityForm, FileEntityForm, ContainerEntityForm
+from fatcat_web.forms import ContainerEntityForm, FileEntityForm, ReleaseEntityForm
DUMMY_DEMO_ENTITIES = {
'container': ('aaaaaaaaaaaaaeiraaaaaaaaai', '00000000-0000-0000-1111-fff000000002'),
diff --git a/python/tests/web_refs.py b/python/tests/web_refs.py
index 72a295e1..0ab69607 100644
--- a/python/tests/web_refs.py
+++ b/python/tests/web_refs.py
@@ -1,11 +1,12 @@
import json
-import pytest
-from fatcat_web.search import get_elastic_container_random_releases
+import pytest
from fatcat_openapi_client.rest import ApiException
from fixtures import *
+from fatcat_web.search import get_elastic_container_random_releases
+
def test_basic_refs(app, mocker):
diff --git a/python/tests/web_search.py b/python/tests/web_search.py
index 8df01466..fdcffdea 100644
--- a/python/tests/web_search.py
+++ b/python/tests/web_search.py
@@ -1,11 +1,12 @@
import json
-import pytest
-from fatcat_web.search import get_elastic_container_random_releases
+import pytest
from fatcat_openapi_client.rest import ApiException
from fixtures import *
+from fatcat_web.search import get_elastic_container_random_releases
+
def test_generic_search(app):