From b77692ccb27a5b8f4a172939caec6ecd79eaff25 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 13 Oct 2021 16:30:16 -0700 Subject: python: additional test coverage for v0.4 changes --- python/tests/api_containers.py | 14 ++++++++++++++ python/tests/api_releases.py | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/python/tests/api_containers.py b/python/tests/api_containers.py index 25a10837..0f6c85b1 100644 --- a/python/tests/api_containers.py +++ b/python/tests/api_containers.py @@ -39,6 +39,20 @@ def test_container(api): assert c2.revision == c2_rev.revision assert c2.name == c2_rev.name + # lookups + tmp = api.lookup_container(issnl=c1.issnl) + assert tmp.revision == c2.revision + tmp = api.lookup_container(issne=c1.issne) + assert tmp.revision == c2.revision + tmp = api.lookup_container(issnp=c1.issnp) + assert tmp.revision == c2.revision + tmp = api.lookup_container(issn=c1.issnp) + assert tmp.revision == c2.revision + with pytest.raises(fatcat_openapi_client.rest.ApiException): + api.lookup_container(issne=c1.issnp) + with pytest.raises(fatcat_openapi_client.rest.ApiException): + api.lookup_container(issnp=c1.issne) + # get redirects (none) assert api.get_container_redirects(c2.ident) == [] diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py index 389d9831..4437b57b 100644 --- a/python/tests/api_releases.py +++ b/python/tests/api_releases.py @@ -33,7 +33,7 @@ def test_release(api): jstor="8328424", mag="9439328", ark="ark:/12025/654xz321", - hdl="20.123.45/asdf", + hdl="20.123.45/ASDF", ), volume="84", number="RFC1234", @@ -100,8 +100,10 @@ def test_release(api): assert r1.ext_ids.core == r2.ext_ids.core assert r1.ext_ids.arxiv == r2.ext_ids.arxiv assert r1.ext_ids.jstor == r2.ext_ids.jstor - assert r1.ext_ids.ark == r2.ext_ids.ark assert r1.ext_ids.mag == r2.ext_ids.mag + assert r1.ext_ids.ark == r2.ext_ids.ark + assert r1.ext_ids.hdl != r2.ext_ids.hdl + assert r1.ext_ids.hdl.lower() == r2.ext_ids.hdl assert r1.number == r2.number assert r1.version == r2.version assert r1.volume == r2.volume @@ -146,6 +148,7 @@ def test_release_examples(api): api.lookup_release(ark='ark:/13030/m53r5pzm') api.lookup_release(mag='992489213') api.lookup_release(hdl='20.500.23456/ABC/DUMMY') + api.lookup_release(hdl='20.500.23456/abc/dummy') # failed lookup exception type try: -- cgit v1.2.3