summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_difflib.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-07-10 23:54:07 (GMT)
committerBrett Cannon <bcannon@gmail.com>2004-07-10 23:54:07 (GMT)
commitd2c5b4b549b24e637b16c60bdfae7292e1e75c06 (patch)
tree08241f92b66f1610de16aba177e163a95480d19a /Lib/test/test_difflib.py
parentb8e1717041e21d2cc4a5d18fe2e948dc475f0d6e (diff)
downloadcpython-d2c5b4b549b24e637b16c60bdfae7292e1e75c06.zip
cpython-d2c5b4b549b24e637b16c60bdfae7292e1e75c06.tar.gz
cpython-d2c5b4b549b24e637b16c60bdfae7292e1e75c06.tar.bz2
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).
Diffstat (limited to 'Lib/test/test_difflib.py')
-rw-r--r--Lib/test/test_difflib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py
index 1703754..9819c84 100644
--- a/Lib/test/test_difflib.py
+++ b/Lib/test/test_difflib.py
@@ -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)