Fix difflib ? hint in diff output when dealing with tabs (#15201)

This commit is contained in:
Anthony Sottile 2019-08-21 11:59:26 -07:00 committed by Tim Peters
parent 092911d5c0
commit e1c638da6a
3 changed files with 20 additions and 23 deletions

View file

@ -89,10 +89,16 @@ class TestSFbugs(unittest.TestCase):
# Check fix for bug #1488943
diff = list(difflib.Differ().compare(["\tI am a buggy"],["\t\tI am a bug"]))
self.assertEqual("- \tI am a buggy", diff[0])
self.assertEqual("? --\n", diff[1])
self.assertEqual("? \t --\n", diff[1])
self.assertEqual("+ \t\tI am a bug", diff[2])
self.assertEqual("? +\n", diff[3])
def test_hint_indented_properly_with_tabs(self):
diff = list(difflib.Differ().compare(["\t \t \t^"], ["\t \t \t^\n"]))
self.assertEqual("- \t \t \t^", diff[0])
self.assertEqual("+ \t \t \t^\n", diff[1])
self.assertEqual("? \t \t \t +\n", diff[2])
def test_mdiff_catch_stop_iteration(self):
# Issue #33224
self.assertEqual(