diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-07-01 14:59:46 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-07-01 14:59:46 (GMT) |
commit | e7dfe21bed410baff8191aebd679f647c9e95a0a (patch) | |
tree | fd5391274e451d0b05dec84624ca1062fb2f93dc /Lib/test/test_difflib.py | |
parent | 37ca8c12dc0fb34736749d1224e1e013f4afd5b4 (diff) | |
download | cpython-e7dfe21bed410baff8191aebd679f647c9e95a0a.zip cpython-e7dfe21bed410baff8191aebd679f647c9e95a0a.tar.gz cpython-e7dfe21bed410baff8191aebd679f647c9e95a0a.tar.bz2 |
Fix SF bug #763023, difflib.py: ratio() zero division not caught
Backport candidate
Diffstat (limited to 'Lib/test/test_difflib.py')
-rw-r--r-- | Lib/test/test_difflib.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py index 5687e32..e33539a 100644 --- a/Lib/test/test_difflib.py +++ b/Lib/test/test_difflib.py @@ -1,3 +1,15 @@ import difflib from test import test_support +import unittest + +class TestSFbugs(unittest.TestCase): + + def test_ratio_for_null_seqn(self): + # Check clearing of SF bug 763023 + s = difflib.SequenceMatcher(None, [], []) + self.assertEqual(s.ratio(), 1) + self.assertEqual(s.quick_ratio(), 1) + self.assertEqual(s.real_quick_ratio(), 1) + +test_support.run_unittest(TestSFbugs) test_support.run_doctest(difflib) |