"""Unit tests for text normalizer.""" def test_html_to_text(): from libs.parser.text_normalizer import html_to_text html = "
Hello world
" text = html_to_text(html) assert "Hello" in text assert "world" in text assert "" not in text def test_normalize_unicode_quotes(): from libs.parser.text_normalizer import normalize_unicode text = "\u2018Hello\u2019 \u201cworld\u201d" result = normalize_unicode(text) assert "'" in result assert '"' in result def test_normalize_em_dash(): from libs.parser.text_normalizer import normalize_unicode text = "Q4\u2014best quarter" result = normalize_unicode(text) assert " - " in result def test_collapse_whitespace(): from libs.parser.text_normalizer import collapse_whitespace text = "Hello\n\n\n\n\nWorld" result = collapse_whitespace(text) assert "Hello" in result assert "World" in result def test_normalize_text_pipeline(): from libs.parser.text_normalizer import normalize_text html = "
Revenue guidance raised. Demand remains strong.
" result = normalize_text(html, is_html=True) assert "Revenue" in result assert "" not in result def test_script_removed(): from libs.parser.text_normalizer import normalize_text html = "
Content
" result = normalize_text(html, is_html=True) assert "var x" not in result assert "Content" in result def test_looks_like_html_detects_sec_exhibit_markup(): from libs.parser.text_normalizer import looks_like_html html = "