Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# **Upcoming release**

- #871 Reject extraction of expressions with nested named expressions (@yangfan-yf-yf)
- #850 Update and pin black version in pre-commit and Github Actions
- #851 Bump supported python version to up to Python 3.14
- #852 Implement patchedast handlers for TypeAlias
- #852 Implement patchedast handlers for TypeAlias
- #853 Implement patchedast handlers TypeVar
- #847 Avoid printing autoimport syntax errors (@yangfan-yf-yf)
- #623, #819, #863 Support MatchOr, MatchSequence, MatchStar (@jheld, @lieryan)
Expand Down
1 change: 1 addition & 0 deletions rope/refactor/usefunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _Return(self, node):

def _NamedExpr(self, node):
self.named_expression += 1
self.visit(node.value)

def _Yield(self, node):
self.yields += 1
Expand Down
17 changes: 5 additions & 12 deletions ropetest/refactor/extracttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2373,18 +2373,11 @@ def foo(a):
start, end = code.index(extract_target), code.index(extract_target) + len(
extract_target
)
refactored = self.do_extract_method(code, start, end, "new_func")
expected = dedent("""\
def foo(a):
if i, c := new_func(a):
i += 1
c += 1
print(i)

def new_func(a):
return (i := a == (c := 5))
""")
self.assertEqual(expected, refactored)
with self.assertRaisesRegex(
rope.base.exceptions.RefactoringError,
"Extracted piece cannot contain named expression \\(:= operator\\).",
):
self.do_extract_method(code, start, end, "new_func")

@testutils.only_for_versions_higher("3.8")
def test_extract_function_expression_with_inline_assignment_in_inner_expression(
Expand Down
Loading