SequenceMatcher(None, [], []).get_grouped_opcodes() now returns a generator

that behaves as if both lists has an empty string in each of them.

Closes bug #979794 (and duplicate bug #980117).
This commit is contained in:
Brett Cannon 2004-07-10 23:54:07 +00:00
parent b8e1717041
commit d2c5b4b549
3 changed files with 13 additions and 0 deletions

View file

@ -12,6 +12,13 @@ class TestSFbugs(unittest.TestCase):
self.assertEqual(s.quick_ratio(), 1)
self.assertEqual(s.real_quick_ratio(), 1)
def test_comparing_empty_lists(self):
# Check fix for bug #979794
group_gen = difflib.SequenceMatcher(None, [], []).get_grouped_opcodes()
self.assertRaises(StopIteration, group_gen.next)
diff_gen = difflib.unified_diff([], [])
self.assertRaises(StopIteration, diff_gen.next)
Doctests = doctest.DocTestSuite(difflib)
test_support.run_unittest(TestSFbugs, Doctests)