bh: thuban/test test_layer.py,1.29,1.29.2.1

cvs@intevation.de cvs at intevation.de
Thu Jun 3 17:29:18 CEST 2004


Author: bh

Update of /thubanrepository/thuban/test
In directory doto:/tmp/cvs-serv19718/test

Modified Files:
      Tag: thuban-1-0-branch
	test_layer.py 
Log Message:
Backport some fixes from HEAD:

* Thuban/Model/layer.py (Layer.TreeInfo): Convert the bounding box
to a tuple before using it as arguments to the % operator.  This
fixes the formatting issue filed in RT#2239 on 2004-01-13 and
reported today on thuban-list by Jan Schüngel

* test/test_layer.py (TestLayerModification.setUp): Save the
filename as an instance variable so we can refer to it in tests
(TestLayerModification.test_tree_info): Uncomment this method
again and make it work.  This tests for the formatting issue
filed in RT#2239 on 2004-01-13


Index: test_layer.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_layer.py,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -d -r1.29 -r1.29.2.1
--- test_layer.py	28 Nov 2003 11:37:35 -0000	1.29
+++ test_layer.py	3 Jun 2004 15:29:16 -0000	1.29.2.1
@@ -1,4 +1,4 @@
-# Copyright (c) 2002, 2003 by Intevation GmbH
+# Copyright (c) 2002, 2003, 2004 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -355,9 +355,9 @@
         """
         self.clear_messages()
         self.session = Session("Test session for %s" % self.__class__)
-        filename = os.path.join("..", "Data", "iceland", "political.shp")
+        self.filename = os.path.join("..", "Data", "iceland", "political.shp")
         self.layer = Layer("Test Layer",
-                           self.session.OpenShapefile(filename))
+                           self.session.OpenShapefile(self.filename))
         self.layer.Subscribe(LAYER_LEGEND_CHANGED, self.subscribe_with_params,
                              LAYER_LEGEND_CHANGED)
         self.layer.Subscribe(LAYER_VISIBILITY_CHANGED,
@@ -416,20 +416,16 @@
         self.failUnless(self.layer.WasModified())
 
 
-#
-# the tree info now contains Color objects which are difficult to test
-#
-#   def test_tree_info(self):
-#       """Test Layer.TreeInfo"""
-#       self.assertEquals(self.layer.TreeInfo(),
-#                         ("Layer 'Test Layer'",
-#                          ['Shown',
-#                           'Shapes: 156',
-#                           ('Extent (lat-lon):'
-#                            ' (-24.5465, 63.2868, -13.4958, 66.5638)'),
-#                           'Shapetype: Polygon',
-#                           'Fill: None',
-#                           'Outline: (0.000, 0.000, 0.000)']))
+    def test_tree_info(self):
+        """Test Layer.TreeInfo"""
+        self.assertEquals(self.layer.TreeInfo(),
+                          ("Layer 'Test Layer'",
+                           ['Filename: %s' % os.path.abspath(self.filename),
+                            'Shown',
+                            'Shapes: 156',
+                   'Extent (lat-lon): (-24.5465, 63.2868, -13.4958, 66.5638)',
+                            'Shapetype: Polygon',
+                            self.layer.GetClassification()]))
 
 
 if __name__ == "__main__":





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)