35 |
import copy |
import copy |
36 |
|
|
37 |
|
|
38 |
class TestClassification(unittest.TestCase): |
class TestClassGroupProperties(unittest.TestCase): |
39 |
|
|
40 |
def test_ClassGroupProperties(self): |
def test(self): |
41 |
"""Test ClassGroupProperties""" |
"""Test ClassGroupProperties""" |
42 |
|
|
43 |
props = ClassGroupProperties() |
props = ClassGroupProperties() |
64 |
self.assertNotEqual(newProps1, props) |
self.assertNotEqual(newProps1, props) |
65 |
self.assertEqual(newProps1, newProps2) |
self.assertEqual(newProps1, newProps2) |
66 |
|
|
67 |
def test_ClassGroup(self): |
|
68 |
|
class TestClassGroup(unittest.TestCase): |
69 |
|
|
70 |
|
def test(self): |
71 |
"""Test ClassGroup""" |
"""Test ClassGroup""" |
72 |
|
|
73 |
# test constructor with no label |
# test constructor with no label |
97 |
# test GetProperties...also a virtual function |
# test GetProperties...also a virtual function |
98 |
#self.assertEqual(group.GetProperties(), None) |
#self.assertEqual(group.GetProperties(), None) |
99 |
|
|
100 |
def test_ClassGroupDefault(self): |
|
101 |
|
class TestClassGroupDefault(unittest.TestCase): |
102 |
|
|
103 |
|
def test(self): |
104 |
"""Test ClassGroupDefault""" |
"""Test ClassGroupDefault""" |
105 |
|
|
106 |
defProps = ClassGroupProperties() |
defProps = ClassGroupProperties() |
140 |
groupCopy = copy.copy(group) |
groupCopy = copy.copy(group) |
141 |
self.assertEqual(group, groupCopy) |
self.assertEqual(group, groupCopy) |
142 |
|
|
143 |
def test_ClassGroupRange(self): |
|
144 |
|
class TestClassGroupRange(unittest.TestCase): |
145 |
|
|
146 |
|
def test(self): |
147 |
"""Test ClassGroupRange""" |
"""Test ClassGroupRange""" |
148 |
|
|
149 |
defProps = ClassGroupProperties() |
defProps = ClassGroupProperties() |
159 |
self.assertEqual(group.GetMax(), 1) |
self.assertEqual(group.GetMax(), 1) |
160 |
self.assertEqual(group.GetProperties(), defProps) |
self.assertEqual(group.GetProperties(), defProps) |
161 |
self.assertEqual(group.GetLabel(), "") |
self.assertEqual(group.GetLabel(), "") |
162 |
|
|
163 |
# test SetMax() |
# test SetMax() |
164 |
self.assertRaises(ValueError, group.SetMax, 0) |
self.assertRaises(ValueError, group.SetMax, 0) |
165 |
self.assertRaises(ValueError, group.SetMax, -1) |
self.assertRaises(ValueError, group.SetMax, -1) |
196 |
groupCopy = copy.copy(group) |
groupCopy = copy.copy(group) |
197 |
self.assertEqual(group, groupCopy) |
self.assertEqual(group, groupCopy) |
198 |
|
|
199 |
def test_ClassGroupSingleton(self): |
|
200 |
|
class TestClassGroupSingleton(unittest.TestCase): |
201 |
|
|
202 |
|
def test(self): |
203 |
"""Test ClassGroupSingleton""" |
"""Test ClassGroupSingleton""" |
204 |
|
|
205 |
defProps = ClassGroupProperties() |
defProps = ClassGroupProperties() |
244 |
# test copy |
# test copy |
245 |
groupCopy = copy.copy(group) |
groupCopy = copy.copy(group) |
246 |
self.assertEqual(group, groupCopy) |
self.assertEqual(group, groupCopy) |
|
|
|
247 |
|
|
248 |
def test_ClassIterator(self): |
|
249 |
|
class TestClassIterator(unittest.TestCase): |
250 |
|
|
251 |
|
def test(self): |
252 |
"""Test ClassIterator""" |
"""Test ClassIterator""" |
253 |
|
|
254 |
groups = [ClassGroupSingleton(5), ClassGroupSingleton(5), |
groups = [ClassGroupSingleton(5), ClassGroupSingleton(5), |
271 |
|
|
272 |
self.assertEquals(list, [0, 1, 1, 2, 1, 0]) |
self.assertEquals(list, [0, 1, 1, 2, 1, 0]) |
273 |
|
|
274 |
def test_classification(self): |
|
275 |
|
class TestClassification(unittest.TestCase): |
276 |
|
|
277 |
|
def test(self): |
278 |
"""Test Classification""" |
"""Test Classification""" |
279 |
|
|
280 |
defProps = ClassGroupProperties() |
defProps = ClassGroupProperties() |
327 |
session.Destroy() |
session.Destroy() |
328 |
layer.Destroy() |
layer.Destroy() |
329 |
|
|
330 |
|
|
331 |
if __name__ == "__main__": |
if __name__ == "__main__": |
332 |
support.run_tests() |
support.run_tests() |