Commits

Anonymous committed 03addc9

Fixed finding similar nodes when only common attributes match

  • Participants
  • Parent commits 9be4010

Comments (0)

Files changed (3)

docs/dev/workingon.txt

 Small Stories
 =============
 
-- Replacing PythonCodeAssist with a function; how to handle templates
-- Moving codeassist from editingtools
-- Fix UI for proposing completions
-- Cannot goto definition in show occurrences menu
+- Extract method ignored some parameters! ``f(1, 2)`` matches ``f(1)``
 
-* Extract method ignored some parameters! ``f(1, 2)`` matches ``f(1)``
 * Replacing `Proposals` with a tuple?
 * Setting `TemplateProposal.kind` to be 'template'
 

rope/refactor/similarfinder.py

                 if not self._match_nodes(child1, child2, mapping):
                     return False
             elif isinstance(child1, (list, tuple)):
-                if not isinstance(child2, (list, tuple)):
+                if not isinstance(child2, (list, tuple)) or \
+                   len(child1) != len(child2):
                     return False
                 for c1, c2 in zip(child1, child2):
                     if not self._match_nodes(c1, c2, mapping):

ropetest/refactor/similarfindertest.py

         result = list(finder.get_matches('${a} = 1'))
         self.assertEquals(1, len(result))
 
+    def test_functions_not_matching_when_only_first_parameters(self):
+        source = 'f(1, 2)\n'
+        finder = similarfinder.SimilarFinder(source)
+        self.assertEquals(0, len(list(finder.get_matches('f(1)'))))
+
 
 class CheckingFinderTest(unittest.TestCase):