fix test_source

This commit is contained in:
Ronny Pfannschmidt 2018-05-23 18:22:18 +02:00
parent 3e08c4ee64
commit d4bf2ff8f5
1 changed files with 4 additions and 4 deletions

View File

@ -341,9 +341,9 @@ class TestSourceParsingAndCompiling(object):
def check(comp, name): def check(comp, name):
co = comp(self.source, name) co = comp(self.source, name)
if not name: if not name:
expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 2) expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 3)
else: else:
expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 2) expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 3)
fn = co.co_filename fn = co.co_filename
assert fn.endswith(expected) assert fn.endswith(expected)
@ -414,7 +414,7 @@ def test_getfuncsource_with_multine_string():
assert ( assert (
str(_pytest._code.Source(f)).strip() str(_pytest._code.Source(f)).strip()
== "def f():\n c = '''while True:\n pass\n'''" == 'def f():\n c = """while True:\n pass\n"""'
) )
@ -429,7 +429,7 @@ def test_deindent():
""" """
lines = deindent(inspect.getsource(f).splitlines()) lines = deindent(inspect.getsource(f).splitlines())
assert lines == ["def f():", " c = '''while True:", " pass", "'''"] assert lines == ["def f():", ' c = """while True:', " pass", '"""']
source = """ source = """
def f(): def f():