Skip to content

Commit

Permalink
Added test with fstring
Browse files Browse the repository at this point in the history
  • Loading branch information
rlbr committed Nov 27, 2024
1 parent 55169bb commit 94a77b6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ropetest/refactor/extracttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,28 @@ def extracted():
""")
self.assertEqual(expected, refactored)

def test_extract_function_with_fstring(self):
code = dedent("""\
def main():
h = 1
g = f"#{h}"
print(g)
""")
start, end = self._convert_line_range_to_offset(code, 3, 3)
refactored = self.do_extract_method(code, start, end, "extracted")

expected = dedent("""\
def main():
h = 1
g = extracted(h)
print(g)
def extracted(h):
g = f"#{h}"
return g
""")
self.assertEqual(expected, refactored)

def test_extract_function_containing_dict_generalized_unpacking(self):
code = dedent("""\
def a_func(dict1):
Expand Down

0 comments on commit 94a77b6

Please sign in to comment.