summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-03 22:46:16 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-03 22:46:16 -0700
commit62d3299471b7b4229ae63e21e9d45ef7efde4348 (patch)
treefc0d04531ce4c81224723bd3646c88f74c7c42a2 /tests
parent58688676ee2d96d9d7006e2fd8a14d47f271aa8f (diff)
downloadfatcat-scholar-62d3299471b7b4229ae63e21e9d45ef7efde4348.tar.gz
fatcat-scholar-62d3299471b7b4229ae63e21e9d45ef7efde4348.zip
reformat python code with black
Diffstat (limited to 'tests')
-rw-r--r--tests/test_djvu_parse.py5
-rw-r--r--tests/test_scrub.py7
-rw-r--r--tests/test_transform.py20
3 files changed, 19 insertions, 13 deletions
diff --git a/tests/test_djvu_parse.py b/tests/test_djvu_parse.py
index abf5a4c..1f23de2 100644
--- a/tests/test_djvu_parse.py
+++ b/tests/test_djvu_parse.py
@@ -1,4 +1,3 @@
-
import io
from fatcat_scholar.djvu import djvu_extract_leaf_texts
@@ -6,10 +5,10 @@ from fatcat_scholar.djvu import djvu_extract_leaf_texts
def test_djvu_extract_leaf_texts():
# https://archive.org/details/ERIC_ED441501
- with open('tests/files/ERIC_ED441501_djvu.xml', 'r') as f:
+ with open("tests/files/ERIC_ED441501_djvu.xml", "r") as f:
blob = f.read()
- leaves = djvu_extract_leaf_texts(io.StringIO(blob), [3,6])
+ leaves = djvu_extract_leaf_texts(io.StringIO(blob), [3, 6])
assert 3 in leaves
assert 6 in leaves
assert "2. Original cataloging tools" in leaves[3]
diff --git a/tests/test_scrub.py b/tests/test_scrub.py
index 6c357ae..5929b65 100644
--- a/tests/test_scrub.py
+++ b/tests/test_scrub.py
@@ -1,4 +1,3 @@
-
import pytest
from fatcat_scholar.schema import *
@@ -6,10 +5,12 @@ from fatcat_scholar.schema import *
def test_scrub():
vectors = [
- ('“Please clean this piece… of text</b>„', '"Please clean this piece... of text"'),
+ (
+ "“Please clean this piece… of text</b>„",
+ '"Please clean this piece... of text"',
+ ),
("<jats:p>blah", "blah"),
]
for raw, fixed in vectors:
assert fixed == scrub_text(raw)
-
diff --git a/tests/test_transform.py b/tests/test_transform.py
index 3c29d18..d831f47 100644
--- a/tests/test_transform.py
+++ b/tests/test_transform.py
@@ -1,28 +1,34 @@
-
import pytest
from fatcat_openapi_client import ReleaseEntity
from fatcat_scholar.schema import *
from fatcat_scholar.api_entities import *
+
def test_es_release_from_release():
- with open('tests/files/release_hsmo6p4smrganpb3fndaj2lon4.json', 'r') as f:
+ with open("tests/files/release_hsmo6p4smrganpb3fndaj2lon4.json", "r") as f:
release = entity_from_json(f.read(), ReleaseEntity)
-
+
obj = es_release_from_release(release)
d = json.loads(obj.json())
- assert obj.ident == release.ident == d['ident'] == "hsmo6p4smrganpb3fndaj2lon4"
+ assert obj.ident == release.ident == d["ident"] == "hsmo6p4smrganpb3fndaj2lon4"
assert obj.doi_registrar == "crossref"
assert obj.doi_prefix == "10.7717"
+
def test_es_biblio_from_release():
- with open('tests/files/release_hsmo6p4smrganpb3fndaj2lon4.json', 'r') as f:
+ with open("tests/files/release_hsmo6p4smrganpb3fndaj2lon4.json", "r") as f:
release = entity_from_json(f.read(), ReleaseEntity)
-
+
obj = es_biblio_from_release(release)
d = json.loads(obj.json())
- assert obj.release_ident == release.ident == d['release_ident'] == "hsmo6p4smrganpb3fndaj2lon4"
+ assert (
+ obj.release_ident
+ == release.ident
+ == d["release_ident"]
+ == "hsmo6p4smrganpb3fndaj2lon4"
+ )