/[thuban]/branches/WIP-pyshapelib-bramz/test/test_selection.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/test_selection.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 536 by bh, Fri Mar 14 20:43:08 2003 UTC revision 723 by bh, Thu Apr 24 15:31:53 2003 UTC
# Line 52  class TestSelection(unittest.TestCase, s Line 52  class TestSelection(unittest.TestCase, s
52          """Destroy all objects in self.to_destroy and clear the message list"""          """Destroy all objects in self.to_destroy and clear the message list"""
53          for obj in self.to_destroy:          for obj in self.to_destroy:
54              obj.Destroy()              obj.Destroy()
55            self.to_destroy = None
56            self.session = None
57            self.selection = None
58          self.clear_messages()          self.clear_messages()
59    
60      def get_layer(self):      def get_layer(self):
61          """Return a layer to have something to test with"""          """Return a layer to have something to test with.
62    
63            Also, instantiate self.session if not done already. The layer
64            (and the session when it is created) are added to
65            self.to_destroy so that they are properly destroyed at the end
66            of the test.
67    
68            The layer should not be added to a map in the session to avoid a
69            situation where its destroy method is called twice. This
70            situation should not arise in the selection tests.
71            """
72            if not hasattr(self, "session"):
73                self.session = Session("Test Session for %s" % self.__class__)
74                self.to_destroy.append(self.session)
75            filename = os.path.join("..", "Data", "iceland", "roads-line.shp")
76          layer = Layer("Selection Test Layer",          layer = Layer("Selection Test Layer",
77                        os.path.join("..", "Data", "iceland", "roads-line.shp"))                        self.session.OpenShapefile(filename))
78          self.to_destroy.append(layer)          self.to_destroy.append(layer)
79          return layer          return layer
80    
# Line 284  class TestSelection(unittest.TestCase, s Line 301  class TestSelection(unittest.TestCase, s
301    
302    
303  if __name__ == "__main__":  if __name__ == "__main__":
304      unittest.main()      support.run_tests()

Legend:
Removed from v.536  
changed lines
  Added in v.723

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26