Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] rename renames keyword args in function calls #18

Closed
mcepl opened this issue Nov 30, 2013 · 0 comments · Fixed by #510
Closed

[TEST] rename renames keyword args in function calls #18

mcepl opened this issue Nov 30, 2013 · 0 comments · Fixed by #510
Assignees
Milestone

Comments

@mcepl
Copy link
Contributor

mcepl commented Nov 30, 2013

hello,

I've written a test for rope that fails when a keyword argument to a function is the same as the name of the variable to be renamed, like this:

a = 10
foo = dict(a=a)

when a is renamed to new_a, the result will look like this:

new_a = 10
foo = dict(new_a=new_a)

This is the test case:

diff -r 1c100ebabc16 ropetest/refactor/renametest.py
--- a/ropetest/refactor/renametest.py   Sat Apr 09 17:20:27 2011 +0200
+++ b/ropetest/refactor/renametest.py   Tue May 10 00:48:39 2011 +0200
@@ -32,6 +32,11 @@
                   get_changes(new_name, **kwds)
         self.project.do(changes)

+    def test_local_variable_but_not_parameter(self):
+        code = "a = 10\nfoo = dict(a=a)"
+        refactored = self._local_rename(code, 1, "new_a")
+        self.assertEquals(refactored, "new_a = 10\nfoo = dict(a=new_a)")
+
     def test_simple_global_variable_renaming(self):
         refactored = self._local_rename('a_var = 20\n', 2, 'new_var')
         self.assertEquals('new_var = 20\n', refactored)

Thank you for this most excellent tool :)

  • Timo
@ghost ghost assigned mcepl Dec 2, 2013
@lieryan lieryan self-assigned this Sep 29, 2021
@lieryan lieryan added this to the 1.4.0 milestone Oct 6, 2022
lieryan added a commit that referenced this issue Oct 6, 2022
When the function is a builtin function, the call parameter's name was
sometimes incorrectly identified as an AssignedName. This led to
rename refactoring incorrectly renaming these parameters.
lieryan added a commit that referenced this issue Oct 6, 2022
When the function is a builtin function, the call parameter's name was
sometimes incorrectly identified as an AssignedName. This led to
rename refactoring incorrectly renaming these parameters.
lieryan added a commit that referenced this issue Oct 6, 2022
…n-keyword-args

Fix #18. Identify AbstractFunction parameters as ParameterName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants