1
0
forked from VimPlug/jedi

Fix get_line_code().

Fixes #948.
This commit is contained in:
Dave Halter
2017-09-09 18:28:05 +02:00
parent ef6a1ca10f
commit 381fedddb4
2 changed files with 11 additions and 10 deletions

View File

@@ -162,18 +162,19 @@ def test_get_line_code():
assert get_line_code('') == ''
# On custom code
first_line = 'def foo():\n'
line = ' foo'
assert get_line_code('def foo():\n%s' % line) == line
code = '%s%s' % (first_line, line)
assert get_line_code(code) == first_line
# With before/after
line = ' foo'
source = 'def foo():\n%s\nother_line' % line
assert get_line_code(source, line=2) == line + '\n'
assert get_line_code(source, line=2, after=1) == line + '\nother_line'
assert get_line_code(source, line=2, after=1, before=1) == source
code = code + '\nother_line'
assert get_line_code(code, line=2) == first_line
assert get_line_code(code, line=2, after=1) == first_line + line + '\n'
assert get_line_code(code, line=2, after=2, before=1) == code
# Should just be the whole thing, since there are no more lines on both
# sides.
assert get_line_code(source, line=2, after=3, before=3) == source
assert get_line_code(code, line=2, after=3, before=3) == code
def test_goto_assignments_follow_imports():