Rename Method refactoring does not change the calls of the renamed method.
researcher175 opened this issue · 0 comments
researcher175 commented
Rename Method refactoring does not change the calls of the renamed method.
In the example, the call to the method in the test file must be renamed to the new name to avoid unexpected parameter calling the method from the superclass
- Steps to reproduce the behavior:
structure
-- main
---- blob.py
-- test
---- test.py
blob.py:
class WordList(list):
def count(self, strg, case_sensitive=False, *args, **kwargs):
return None
test.py:
from unittest import TestCase
from main import blobl as tb
class WordListTest(TestCase):
def test_count(self):
wl = tb.WordList(['monty', 'python', 'Python', 'Monty'])
self.assertEqual(wl.count('monty'), None)
self.assertEqual(wl.count('monty', case_sensitive=True), None)
-
Apply the Rename Method refactoring with the new name 'start_index' to the method 'WordList.count'
-
Expected code after refactoring:
structure:
-- main
---- blob.py
-- test
---- test.py
blob.py:
class WordList(list):
def start_index(self, strg, case_sensitive=False, *args, **kwargs):
return None
test.py:
from unittest import TestCase
from main import blobl as tb
class WordListTest(TestCase):
def test_count(self):
wl = tb.WordList(['monty', 'python', 'Python', 'Monty'])
self.assertEqual(wl.count('monty'), None)
self.assertEqual(wl.start_index('monty', case_sensitive=True), None)
- Not all uses of the touched method are changed