MCPcopy Index your code
hub / github.com/python/cpython / test_close_matches_aligned

Method test_close_matches_aligned

Lib/test/test_difflib.py:286–304  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

284
285class 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)

Callers

nothing calls this directly

Calls 3

listClass · 0.85
compareMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected