python-rope / rope

a python refactoring library
GNU Lesser General Public License v3.0
1.96k stars 164 forks source link

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

Open researcher175 opened 8 months ago

researcher175 commented 8 months ago

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
2. Apply the Rename Method refactoring with any new name to 'BaseFormat.to_iterable'

3. Expected code after refactoring:
```python
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