Commits

Ali Gholami Rudi  committed b1573ad

findit: added Location.region

  • Participants
  • Parent commits 261cb6d

Comments (0)

Files changed (2)

File rope/contrib/findit.py

 
     def __init__(self, occurrence):
         self.resource = occurrence.resource
-        self.offset = occurrence.get_word_range()[0]
+        self.region = occurrence.get_word_range()
+        self.offset = self.region[0]
         self.unsure = occurrence.is_unsure()
         self.lineno = occurrence.lineno
 

File ropetest/contrib/findittest.py

     def test_trivial_find_definition(self):
         code = 'def a_func():\n    pass\na_func()'
         result = find_definition(self.project, code, len(code) - 3)
-        self.assertEquals(code.index('a_func'), result.offset)
+        start = code.index('a_func')
+        self.assertEquals(start, result.offset)
         self.assertEquals(None, result.resource)
         self.assertEquals(1, result.lineno)
+        self.assertEquals((start, start + len('a_func')), result.region)
 
 
 def suite():