@@ -1406,6 +1406,33 @@ def test_reference_filtering(self):
14061406 any (isinstance (cite , ReferenceCitation ) for cite in citations )
14071407 )
14081408
1409+ def test_markup_text_without_html_clean_step (self ) -> None :
1410+ """Does passing `markup_text` without an `html` clean step auto-add
1411+ it (with a warning) instead of crashing?
1412+
1413+ """
1414+ markup = "<p>Lissner v. Test, <i>1 U.S. 1</i> (1982)</p>"
1415+
1416+ # clean_steps omitted entirely (get_citations defaults it to None)
1417+ with self .assertLogs ("eyecite.models" , level = "WARNING" ) as logs :
1418+ cites = get_citations (markup_text = markup )
1419+ self .assertEqual ([c .matched_text () for c in cites ], ["1 U.S. 1" ])
1420+ self .assertTrue (
1421+ any ("`html` has been added" in line for line in logs .output )
1422+ )
1423+
1424+ # clean_steps provided but missing "html", must prepend it
1425+ with self .assertLogs ("eyecite.models" , level = "WARNING" ):
1426+ cites = get_citations (
1427+ markup_text = markup , clean_steps = ["all_whitespace" ]
1428+ )
1429+ self .assertEqual ([c .matched_text () for c in cites ], ["1 U.S. 1" ])
1430+
1431+ # clean_steps already containing "html" stays untouched and quiet
1432+ with self .assertNoLogs ("eyecite.models" , level = "WARNING" ):
1433+ cites = get_citations (markup_text = markup , clean_steps = ["html" ])
1434+ self .assertEqual ([c .matched_text () for c in cites ], ["1 U.S. 1" ])
1435+
14091436 def test_markup_plaintiff_and_antecedent_guesses (self ) -> None :
14101437 # Can we identify full case names in markup text
14111438 test_pairs = (
0 commit comments