Fix diff parser: get_last_line was sometimes wrong

Now the calculation is way simpler. Still annoying that it even happened.
This commit is contained in:
Dave Halter
2019-01-02 01:39:53 +01:00
parent 64cf24d9da
commit d2542983e9
2 changed files with 38 additions and 13 deletions

View File

@@ -609,3 +609,34 @@ def test_differing_docstrings(differ):
differ.initialize(code1)
differ.parse(code2, parsers=3, copies=1)
differ.parse(code1, parsers=3, copies=1)
def test_one_call_in_function_change(differ):
code1 = dedent('''\
def f(self):
mro = [self]
for a in something:
yield a
def g(self):
return C(
a=str,
b=self,
)
''')
code2 = dedent('''\
def f(self):
mro = [self]
def g(self):
return C(
a=str,
t
b=self,
)
''')
differ.initialize(code1)
differ.parse(code2, parsers=1, copies=1, expect_error_leaves=True)
differ.parse(code1, parsers=2, copies=1)