From 52f0c88ddd618fd1046c98306d72b6ce253bd640 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Tue, 19 Mar 2024 19:20:47 -0400 Subject: [PATCH] fix(models): Adds missing parenthesis to the corrected_citation_full method --- eyecite/models.py | 4 ++-- tests/test_ModelsTest.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/eyecite/models.py b/eyecite/models.py index 5f52922..69a7d9a 100644 --- a/eyecite/models.py +++ b/eyecite/models.py @@ -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) @@ -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) diff --git a/tests/test_ModelsTest.py b/tests/test_ModelsTest.py index 906aa29..cb59efb 100644 --- a/tests/test_ModelsTest.py +++ b/tests/test_ModelsTest.py @@ -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)", + )