| 10 | |
| 11 | |
| 12 | class NormalizeUnicodeTests(unittest.TestCase): |
| 13 | def test_empty_string_returns_empty(self): |
| 14 | self.assertEqual(normalize_unicode(""), "") |
| 15 | |
| 16 | def test_ligatures_replaced(self): |
| 17 | text = "finance flows affiliated" |
| 18 | self.assertEqual(normalize_unicode(text), "finance flows affiliated") |
| 19 | |
| 20 | def test_smart_quotes_to_ascii(self): |
| 21 | text = "\u201chello\u201d \u2018world\u2019" |
| 22 | self.assertEqual(normalize_unicode(text), "\"hello\" 'world'") |
| 23 | |
| 24 | def test_em_dash_to_hyphen(self): |
| 25 | self.assertEqual(normalize_unicode("a\u2014b"), "a-b") |
| 26 | |
| 27 | def test_nfkc_collapses_fullwidth(self): |
| 28 | # Fullwidth digits collapse to ASCII under NFKC. |
| 29 | self.assertEqual(normalize_unicode("\uff11\uff12\uff13"), "123") |
| 30 | |
| 31 | def test_control_chars_dropped(self): |
| 32 | text = "hello\x00world\x07!" |
| 33 | self.assertEqual(normalize_unicode(text), "helloworld!") |
| 34 | |
| 35 | def test_newlines_and_tabs_preserved(self): |
| 36 | text = "line1\nline2\tcol" |
| 37 | self.assertEqual(normalize_unicode(text), "line1\nline2\tcol") |
| 38 | |
| 39 | |
| 40 | class CollapseWhitespaceTests(unittest.TestCase): |
nothing calls this directly
no outgoing calls
no test coverage detected