Rename Method refactoring does not change the calls of the renamed method.

Aberta
#772 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 7 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
devtools

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug rename-refactor

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

  1. 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)

  1. Apply the Rename Method refactoring with the new name 'start_index' to the method 'WordList.count'

  2. 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)

  1. Not all uses of the touched method are changed
Linguagem predominante
Python
Estrelas
2.2k
Forks
197
Merge médio
2d 13h
PRs com merge (30d)
5

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python-rope/rope

Todas as issues de python-rope/rope

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.