Skip to content

Commit

Permalink
Merge pull request #138 from mattdahl/issue-137-fix-hyperscan-duplica…
Browse files Browse the repository at this point in the history
…te-editions

Issue 137 - Fix Hyperscan duplicate editions bug
  • Loading branch information
mlissner authored Feb 24, 2023
2 parents b99e203 + 0223197 commit 743b3b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eyecite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ def merge(self, other: "Token") -> Optional["Token"]:
self.variation_editions = cast(
tuple, self.variation_editions
) + cast(tuple, other.variation_editions)
# Remove duplicate editions after merge
self.exact_editions = tuple(set(self.exact_editions))
self.variation_editions = tuple(set(self.variation_editions))
return self
return None

Expand Down
4 changes: 4 additions & 0 deletions tests/test_FindTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def test_find_citations(self):
# Test with page number that is indicated as missing
('1 U.S. ___',
[case_citation(volume='1', reporter='U.S.', page=None)]),
# Test with page number that is indicated as missing, followed by
# a comma (cf. eyecite#137)
('1 U. S. ___,',
[case_citation(volume='1', reporter_found='U. S.', page=None)]),
# Test with the 'digit-REPORTER-digit' corner-case formatting
('2007-NMCERT-008',
[case_citation(source_text='2007-NMCERT-008', page='008',
Expand Down

0 comments on commit 743b3b3

Please sign in to comment.