Rename Method refactoring does not change the calls of the renamed method.
I maintainer di solito rispondono entro 7 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Reproduce with the two-file example: main/blob.py defines WordList.count and test/test.py calls it, first with a positional argument and then with case_sensitive=True. Rename the method to start_index through rope's rename-method refactoring and check which call sites in the test are left unchanged. Done means every call to WordList.count in the test is renamed, matching the expected output in the issue. Finding those call sites depends on rope's type inference for subclasses of list, so start there.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- 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)
-
Apply the Rename Method refactoring with the new name 'start_index' to the method 'WordList.count'
-
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)
- Not all uses of the touched method are changed
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 197
- Merge medio
- 2g 13h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-rope/rope
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
python-rope/rope#927 ·
I maintainer di solito rispondono entro 7 giorni
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionForse già presa @aliassar l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
python-rope/rope#926 ·
I maintainer di solito rispondono entro 7 giorni
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetForse già presa @sean0407 l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
python-rope/rope#913 ·
I maintainer di solito rispondono entro 7 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
python-rope/rope#925 ·
I maintainer di solito rispondono entro 7 giorni
-
Extract method/variable and introduce parameter don't check whether the new name is already in useAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
python-rope/rope#924 ·
I maintainer di solito rispondono entro 7 giorni
Tutte le issue di python-rope/rope
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
unionai-oss/pandera#2640 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JdeRobot/RoboticsInfrastructure#843 ·
I maintainer di solito rispondono entro 1 giorno
-
automated endpoint-dead needs-curation
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
almanac-data/climate-almanac#122 ·
I maintainer di solito rispondono entro 1 giorno
-
area:harness enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
evarness-ai/iris-harness#420 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
suitenumerique/find#206 ·
I maintainer di solito rispondono entro 2 giorni