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

Method test_default_args

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

Source from the content-addressed store, hash-verified

580 [b[i:i + n + 1] for i in range(0, len(b) - n - 1)])
581
582 def test_default_args(self):
583 a = 'foo bar'
584 b = 'foo baz bar'
585 sm = difflib.SequenceMatcher(a=a, b=b)
586 match = sm.find_longest_match()
587 self.assertEqual(match.a, 0)
588 self.assertEqual(match.b, 0)
589 self.assertEqual(match.size, 6)
590 self.assertEqual(a[match.a: match.a + match.size],
591 b[match.b: match.b + match.size])
592 self.assertFalse(self.longer_match_exists(a, b, match.size))
593
594 match = sm.find_longest_match(alo=2, blo=4)
595 self.assertEqual(match.a, 3)
596 self.assertEqual(match.b, 7)
597 self.assertEqual(match.size, 4)
598 self.assertEqual(a[match.a: match.a + match.size],
599 b[match.b: match.b + match.size])
600 self.assertFalse(self.longer_match_exists(a[2:], b[4:], match.size))
601
602 match = sm.find_longest_match(bhi=5, blo=1)
603 self.assertEqual(match.a, 1)
604 self.assertEqual(match.b, 1)
605 self.assertEqual(match.size, 4)
606 self.assertEqual(a[match.a: match.a + match.size],
607 b[match.b: match.b + match.size])
608 self.assertFalse(self.longer_match_exists(a, b[1:5], match.size))
609
610 def test_longest_match_with_popular_chars(self):
611 a = 'dabcd'

Callers

nothing calls this directly

Calls 4

find_longest_matchMethod · 0.95
longer_match_existsMethod · 0.95
assertFalseMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected