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

Abierto
#772 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 7 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
2.2k
Forks
197
Merge medio
2 d 13 h
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python-rope/rope

Todos los issues de python-rope/rope

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.