Skip to content

Commit

Permalink
Add more tests around extract indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
raymyers authored and lieryan committed Jan 11, 2024
1 parent 7ebf247 commit f4fc0cd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ropetest/refactor/extracttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,39 @@ def test_raising_exception_on_incomplete_block_5(self):
with self.assertRaises(rope.base.exceptions.RefactoringError):
self.do_extract_method(code, start, end, "new_func")

def test_no_incomplete_error_for_weird_indentation(self):
code = dedent("""\
def foo():
if foo:
s = \"""
blah blah
blah
\"""
print(
a, b, c
)
""")
start = code.index("s =") + 3
after_first_triple_quote = code.index('"""') + 3
end = code.index('"""', after_first_triple_quote) + 3
self.do_extract_method(code, start, end, "new_func")

def test_no_incomplete_error_for_weird_indentation2(self):
code = dedent("""\
def foo():
print(
a, [
3,
4
],
c
)
""")
start = code.index("[")
end = code.index(']') + 1
print(code[start:end])
self.do_extract_method(code, start, end, "new_func")

def test_extract_method_and_extra_blank_lines(self):
code = dedent("""\
Expand Down

0 comments on commit f4fc0cd

Please sign in to comment.