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 name of the super method in the classes that override it #770

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

Comments

@researcher175
Copy link

Rename Method refactoring applied to a method defined in a super class does not modify the signature of the method in the classes that override it

  1. Steps to reproduce the behavior:
class BaseFormat(object):
    def __init__(self, fp, **kwargs):
        pass

    def to_iterable(self):
        raise NotImplementedError('Must implement a "to_iterable" method.')


class DelimitedFormat(BaseFormat):
    def __init__(self, fp, **kwargs):
        BaseFormat.__init__(self, fp, **kwargs)

    def to_iterable(self):
        return None
  1. Apply the Rename Method refactoring with any new name to 'BaseFormat.to_iterable'

  2. Expected code after refactoring:

class BaseFormat(object):
    def __init__(self, fp, **kwargs):
        pass

    def new_method_name(self):
        raise NotImplementedError('Must implement a "to_iterable" method.')


class DelimitedFormat(BaseFormat):
    def __init__(self, fp, **kwargs):
        BaseFormat.__init__(self, fp, **kwargs)

    def new_method_name(self):
        return None
  1. The method that overrides the original method in the subclass is not renamed
@researcher175 researcher175 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