Commits

Ali Gholami Rudi  committed b5de189

Changing hash and equals implementations of Resource; It is reference object

  • Participants
  • Parent commits 10bcf4d

Comments (0)

Files changed (3)

File docs/workingon.txt

 Rename modules/packages
 =======================
 
-* Renaming `Resource`\s
-* What if destination is a directory
-* Exceptional conditions; Destination not directory
-
+* Handle ``from x import y`` in NameScopeFinder
+* Rename module resource
 * Handle ``from`` imports
 
 

File rope/project.py

             return destination + '/' + self.get_name()
         return destination
 
-    def __hash__(self):
-        return hash(self.get_path())
-
-    def __eq__(self, resource):
-        if type(resource) != type(self):
-            return False
-        return self.get_path() == resource.get_path()
-
 
 class _File(Resource):
     """Represents a file in a project"""

File ropetest/projecttest.py

         self.assertEquals(my_file, my_folder.get_child('my_file.txt'))
         self.assertEquals('my_folder/my_file.txt', my_file.get_path())
                           
+    def test_moving_files_and_reference_objects(self):
+        root_folder = self.project.get_root_folder()
+        my_file = root_folder.create_file('my_file.txt')
+        old_hash = hash(my_file)
+        my_file.move('my_other_file.txt')
+        self.assertEquals(old_hash, hash(my_file))
+                          
 
 class SampleObserver(object):
     def __init__(self):
 
 
 class FileFinderTest(unittest.TestCase):
+    
     def setUp(self):
         unittest.TestCase.setUp(self)
         self.projectMaker = SampleProjectMaker()