diff --git a/src/caselawclient/models/neutral_citation_mixin.py b/src/caselawclient/models/neutral_citation_mixin.py index 99e2976d..ac76ea4f 100644 --- a/src/caselawclient/models/neutral_citation_mixin.py +++ b/src/caselawclient/models/neutral_citation_mixin.py @@ -40,4 +40,7 @@ def neutral_citation(self) -> Optional[NeutralCitationString]: ... @cached_property @deprecated("Legacy usage of NCNs is deprecated; you should be moving to the Identifiers framework") def has_valid_ncn(self) -> bool: - return self.neutral_citation is not None and neutral_url(self.neutral_citation) is not None + """Return `False` if the document has an NCN and it's invalid, otherwise return `True`.""" + if not self.neutral_citation: + return True + return bool(neutral_url(self.neutral_citation)) diff --git a/tests/models/test_judgments.py b/tests/models/test_judgments.py index 12c49658..d9962d6b 100644 --- a/tests/models/test_judgments.py +++ b/tests/models/test_judgments.py @@ -53,7 +53,7 @@ def test_judgment_neutral_citation(self, mock_api_client): ("[2022] UKFTT 1 (TC)", True), ("[2022] UKFTT 1 (GRC)", True), ("[2022] EWHC 1 (KB)", True), - ("", False), + ("", True), # An empty NCN should return True ("1604] EWCA Crim 555", False), ("[2022 EWHC 1 Comm", False), ("[1999] EWCOP", False), diff --git a/tests/models/test_press_summaries.py b/tests/models/test_press_summaries.py index 7a2df75d..0c7e49ed 100644 --- a/tests/models/test_press_summaries.py +++ b/tests/models/test_press_summaries.py @@ -59,7 +59,7 @@ def test_press_summary_neutral_citation(self, mock_api_client): ("[2022] UKFTT 1 (TC)", True), ("[2022] UKFTT 1 (GRC)", True), ("[2022] EWHC 1 (KB)", True), - ("", False), + ("", True), # An empty NCN should return True ("1604] EWCA Crim 555", False), ("[2022 EWHC 1 Comm", False), ("[1999] EWCOP", False),