From 1c19c5fd68e86473c8f7ee4dbbc6929bb9ee8199 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Sun, 29 Nov 2020 22:20:02 +0100 Subject: address possible None value --- fuzzycat/verify.py | 2 +- tests/test_verify.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fuzzycat/verify.py b/fuzzycat/verify.py index 2eff873..9848735 100644 --- a/fuzzycat/verify.py +++ b/fuzzycat/verify.py @@ -182,7 +182,7 @@ def compare(a, b): # beware: we have versions and "isPartOf", e.g. https://api.fatcat.wiki/v0/release/ybxygpeypbaq5pfrztu3z2itw4 # TODO: does glom help? # ... - if "datacite" in a.get("extra") and "datacite" in b.get("extra"): + if "datacite" in (a.get("extra", []) or []) and "datacite" in (b.get("extra", []) or []): whitelist = set([ "HasPart", "HasVersion", diff --git a/tests/test_verify.py b/tests/test_verify.py index 4789311..d740c06 100644 --- a/tests/test_verify.py +++ b/tests/test_verify.py @@ -45,8 +45,9 @@ def test_compare(): "skipping test {base}release/{a} {base}release/{b} -- no result defined (we think {status}, {reason})" .format(a=a, b=b, base=FATCAT_BASE_URL, status=status, reason=reason)) continue - assert status_mapping[expected_status] == status, "status: want {}, got {} for {} {}".format( - expected_status, status, a, b) + assert status_mapping[ + expected_status] == status, "status: want {}, got {} for {} {}".format( + expected_status, status, a, b) if expected_reason: assert expected_reason.lower() == reason.lower( ), "reason [{} {}]: want {}, got {}".format(a, b, expected_reason, reason) -- cgit v1.2.3