Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 137 - Fix Hyperscan duplicate editions bug #138

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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