(self)
| 284 | |
| 285 | class TestDiffer(unittest.TestCase): |
| 286 | def test_close_matches_aligned(self): |
| 287 | # Of the 4 closely matching pairs, we want 1 to match with 3, |
| 288 | # and 2 with 4, to align with a "top to bottom" mental model. |
| 289 | a = ["cat\n", "dog\n", "close match 1\n", "close match 2\n"] |
| 290 | b = ["close match 3\n", "close match 4\n", "kitten\n", "puppy\n"] |
| 291 | m = difflib.Differ().compare(a, b) |
| 292 | self.assertEqual(list(m), |
| 293 | ['- cat\n', |
| 294 | '- dog\n', |
| 295 | '- close match 1\n', |
| 296 | '? ^\n', |
| 297 | '+ close match 3\n', |
| 298 | '? ^\n', |
| 299 | '- close match 2\n', |
| 300 | '? ^\n', |
| 301 | '+ close match 4\n', |
| 302 | '? ^\n', |
| 303 | '+ kitten\n', |
| 304 | '+ puppy\n']) |
| 305 | |
| 306 | def test_one_insert(self): |
| 307 | m = difflib.Differ().compare('b' * 2, 'a' + 'b' * 2) |
nothing calls this directly
no test coverage detected