Rename Method refactoring allowed for methods defined to implement container objects
It would be nice if Rope sent an alert to the user to avoid incompatible parameter type errors when using the "len()" function.
Steps to reproduce the behavior:
Code before refactoring:
structure
-- main
---- main.py
-- test
---- test.py
main.py:
implements_to_string = lambda x: x
@implements_to_string
class StringlikeMixin(object):
def __len__(self):
return len(self._strkey())
class BaseBlob(StringlikeMixin):
def __init__(self, text):
self.raw = text
def _strkey(self):
return self.raw
class Sentence(BaseBlob):
def __init__(self, sentence, start_index=0, end_index=None, *args, **kwargs):
super(Sentence, self).__init__(sentence, *args, **kwargs)
test.py:
from unittest import TestCase
from main import main as tb
class SentenceTest(TestCase):
def setUp(self):
self.raw_sentence = 'Any place with frites and Belgian beer has my vote.'
self.sentence = tb.Sentence(self.raw_sentence)
def test_len(self):
self.assertEqual(len(self.sentence), len(self.raw_sentence))
Apply the Rename Method refactoring with the new name 'text' to the method 'StringlikeMixin.__len__'
Rename Method refactoring allowed for methods defined to implement container objects It would be nice if Rope sent an alert to the user to avoid incompatible parameter type errors when using the "len()" function.
Steps to reproduce the behavior:
structure
main.py:
test.py: