From 1b39abfa1c7233dd61dc49a267d7a8531646ba8f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 13 Sep 2020 22:12:33 -0700 Subject: util: parse ISSN format with extra spaces --- chocula/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chocula/util.py b/chocula/util.py index ce48ab6..b915e94 100644 --- a/chocula/util.py +++ b/chocula/util.py @@ -362,6 +362,7 @@ def test_clean_str(): def clean_issn(s: str) -> Optional[str]: s = s.strip().upper() + s = s.replace(' ', '') if len(s) == 8: s = s[:4] + "-" + s[4:] if len(s) != 9 or s[4] != "-": @@ -373,3 +374,4 @@ def test_clean_issn(): assert clean_issn("1234-5678") == "1234-5678" assert clean_issn(" 12345678") == "1234-5678" assert clean_issn("123445678") == None + assert clean_issn("2249 - 8257") == "2249-8257" -- cgit v1.2.3