Skip to content

Commit

Permalink
fix(models): Adds missing parenthesis to the corrected_citation_full …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
ERosendo committed Mar 19, 2024
1 parent dd3b52d commit 52f0c88
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eyecite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def corrected_citation_full(self):
if m.pin_cite:
parts.append(f", {m.pin_cite}")
if m.year:
parts.append(f" ({m.year}")
parts.append(f" ({m.year})")
if m.parenthetical:
parts.append(f" ({m.parenthetical})")
return "".join(parts)
Expand Down Expand Up @@ -462,7 +462,7 @@ def corrected_citation_full(self):
parts.append(m.extra)
publisher_date = " ".join(i for i in (m.court, m.year) if i)
if publisher_date:
parts.append(f" ({publisher_date}")
parts.append(f" ({publisher_date})")
if m.parenthetical:
parts.append(f" ({m.parenthetical})")
return "".join(parts)
Expand Down
19 changes: 19 additions & 0 deletions tests/test_ModelsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,22 @@ def test_hash_function_identity(self):
self.assertEqual(hash(citation), citation.__hash__())
self.assertEqual(hash(resource), resource.__hash__())
print("✓")

def test_corrected_full_citation_includes_closing_parenthesis(self):
"""Does the corrected_citation_full method return a properly formatted
citation?"""
journal_citation = get_citations(
"Originalism without Foundations, 65 N.Y.U. L. Rev. 1373 (1990)"
)[0]
self.assertEqual(
journal_citation.corrected_citation_full(),
"65 N.Y.U. L. Rev. 1373 (1990)",
)

full_case_citation = get_citations(
"Meritor Sav. Bank v. Vinson, 477 U.S. 57, 60 (1986)"
)[0]
self.assertEqual(
full_case_citation.corrected_citation_full(),
"Bank v. Vinson, 477 U.S. 57, 60 (scotus 1986)",
)

0 comments on commit 52f0c88

Please sign in to comment.