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

Annotation of /branches/WIP-pyshapelib-bramz/test/test_classification.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 446 - (hide annotations)
Thu Feb 27 16:05:10 2003 UTC (22 years ago) by jonathan
Original Path: trunk/thuban/test/test_classification.py
File MIME type: text/x-python
File size: 2420 byte(s)
Use new Classification and Group classes.

1 jonathan 369 # Copyright (c) 2002 by Intevation GmbH
2     # Authors:
3     # Jonathan Coles <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8     """
9     Test the Classification class
10     """
11    
12     __version__ = "$Revision$"
13     # $Source$
14     # $Id$
15    
16     import unittest
17    
18     import support
19     support.initthuban()
20    
21     from Thuban.Model.classification import Classification
22 jonathan 395 from Thuban.Model.layer import Layer
23 jonathan 369
24    
25     class TestClassification(unittest.TestCase):
26    
27     def test_classification(self):
28     """Test Classification"""
29    
30 jonathan 395 layer = Layer("asdf", "../Data/iceland/political.shp")
31    
32 jonathan 369 #
33     # init with no params
34     #
35 jonathan 395 c = Classification(layer)
36 jonathan 446 self.assertEqual(c.GetField(), None)
37     self.assertNotEqual(c.GetDefaultGroup(), None)
38 jonathan 369
39     #
40 jonathan 395 # SetField
41 jonathan 369 #
42 jonathan 395 c = Classification(layer)
43     c.SetField("Test")
44     self.assertEqual(c.field, "Test")
45     c.SetField(None)
46     self.assertEqual(c.field, None)
47 jonathan 369
48     #
49     # init with field
50     #
51 jonathan 395 c = Classification(layer, "Test")
52     self.assertEqual(c.field, "Test")
53 jonathan 369
54     #
55 jonathan 395 # GetProperties
56 jonathan 369 #
57    
58 jonathan 409 # self.assertEqual(c0.GetProperties(-10), "1")
59     # self.assertEqual(c0.GetProperties(-11), default0)
60     # self.assertEqual(c0.GetProperties(0), "2") # min <= x < max
61     # self.assertEqual(c0.GetProperties(10), default0)
62     # self.assertEqual(c0.GetProperties(11), default0)
63 jonathan 369
64 jonathan 409 # self.assertEqual(c1.GetProperties(0), "1")
65     # self.assertEqual(c1.GetProperties("0"), "2")
66     # self.assertEqual(c1.GetProperties(-1), default1)
67     # self.assertEqual(c1.GetProperties(1), default1)
68     # self.assertRaises(TypeError, c1.GetProperties, {'monty':'python'})
69 jonathan 369
70 jonathan 409 # #
71     # # toggle field
72     # #
73 jonathan 369
74 jonathan 409 # c0.SetField(None)
75     # self.assertEqual(c0.GetProperties(10), default0)
76     # self.assertEqual(c0.GetProperties(11), default0)
77 jonathan 369
78 jonathan 409 # c1.SetField(None)
79     # self.assertEqual(c1.GetProperties(0), default1)
80     # self.assertEqual(c1.GetProperties("0"), default1)
81 jonathan 369
82 jonathan 409 # c0.SetField("c0")
83     # self.assertEqual(c0.GetProperties(10), default0)
84     # self.assertEqual(c0.GetProperties(11), default0)
85 jonathan 369
86 jonathan 409 # c1.SetField("c1")
87     # self.assertEqual(c1.GetProperties(0), "1")
88     # self.assertEqual(c1.GetProperties("0"), "2")
89 jonathan 369
90     if __name__ == "__main__":
91     unittest.main()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26