rope icon indicating copy to clipboard operation
rope copied to clipboard

Rename Method refactoring does not change the name of the super method in the classes that override it

Open jonh-copin opened this issue 1 year ago • 0 comments

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

jonh-copin avatar Feb 27 '24 13:02 jonh-copin