Skip to content

Commit

Permalink
feat(FCL-553): an empty NCN is now considered to be valid
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed Dec 19, 2024
1 parent 08c2bfe commit c68c2bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/caselawclient/models/neutral_citation_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion tests/models/test_judgments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_press_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit c68c2bf

Please sign in to comment.