mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix SF bug #763023, difflib.py: ratio() zero division not caught
Backport candidate
This commit is contained in:
parent
37ca8c12dc
commit
e7dfe21bed
3 changed files with 23 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue