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

Rename Method refactoring does not change the calls of the renamed method. #772

Open
jonhnanthan opened this issue Feb 27, 2024 · 0 comments
Labels
bug Unexpected or incorrect user-visible behavior rename-refactor

Comments

@jonhnanthan
Copy link

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

  1. 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)
  1. Apply the Rename Method refactoring with the new name 'start_index' to the method 'WordList.count'

  2. 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)
  1. Not all uses of the touched method are changed
@jonhnanthan jonhnanthan added the bug Unexpected or incorrect user-visible behavior label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior rename-refactor
Projects
None yet
Development

No branches or pull requests

2 participants