aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_transform.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-10-22 20:17:06 -0700
committerBryan Newbold <bnewbold@archive.org>2020-10-22 20:17:06 -0700
commit498677bbe0a04af2ca527bdff83d02bb0710dac9 (patch)
tree56d81229be53955ca5b2d1ad28602f5f46db65bf /tests/test_transform.py
parent65f880565d462950f4bcc10e77ad423d6cc3bf65 (diff)
downloadfatcat-scholar-498677bbe0a04af2ca527bdff83d02bb0710dac9.tar.gz
fatcat-scholar-498677bbe0a04af2ca527bdff83d02bb0710dac9.zip
improve test coverage
Diffstat (limited to 'tests/test_transform.py')
-rw-r--r--tests/test_transform.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_transform.py b/tests/test_transform.py
index e073591..927c13b 100644
--- a/tests/test_transform.py
+++ b/tests/test_transform.py
@@ -2,6 +2,7 @@ from fatcat_openapi_client import ReleaseEntity
from fatcat_scholar.schema import *
from fatcat_scholar.api_entities import *
+from fatcat_scholar.transform import *
def test_es_release_from_release() -> None:
@@ -31,3 +32,45 @@ def test_es_biblio_from_release() -> None:
== d["release_ident"]
== "hsmo6p4smrganpb3fndaj2lon4"
)
+
+
+def test_run_refs() -> None:
+
+ with open("tests/files/work_iarm6swodra2bcrzhxrfaah7py_bundle.json", "r") as f:
+ run_refs(f.readlines())
+
+
+def test_run_transform() -> None:
+
+ with open("tests/files/work_iarm6swodra2bcrzhxrfaah7py_bundle.json", "r") as f:
+ run_transform(f.readlines())
+
+ with open("tests/files/sim_page_bundle.json", "r") as f:
+ run_transform(f.readlines())
+
+
+def test_biblio_metadata_hacks() -> None:
+ biblio = ScholarBiblio(
+ title="some example paper",
+ contrib_names=["able seaperson"],
+ release_year=2000,
+ volume="10",
+ issue="5",
+ publisher="some university",
+ issns=[],
+ affiliations=[],
+ )
+ out = biblio_metadata_hacks(biblio)
+
+ biblio.release_year = 2030
+ out = biblio_metadata_hacks(biblio)
+ assert out.release_year == None
+
+ biblio.doi_prefix = "10.1101"
+ biblio.container_name = None
+ biblio.release_stage = None
+ biblio.release_type = "post"
+ out = biblio_metadata_hacks(biblio)
+ assert out.container_name
+ assert out.release_stage == "submitted"
+ assert out.release_type == "article"