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

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

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

revision 618 by jonathan, Mon Apr 7 08:58:26 2003 UTC revision 884 by jonathan, Fri May 9 16:34:53 2003 UTC
# Line 20  import unittest Line 20  import unittest
20  import support  import support
21  support.initthuban()  support.initthuban()
22    
23  from Thuban.Model.table import *  import os
24  from Thuban.Model.classification import *  from Thuban.Model.color import Color
25    from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_STRING, FIELDTYPE_DOUBLE
26    from Thuban.Model.classification import \
27        Classification, ClassGroup, \
28        ClassGroupDefault, ClassGroupSingleton, ClassGroupRange,\
29        ClassGroupProperties
30    
31    from Thuban.Model.session import Session
32  from Thuban.Model.layer import Layer  from Thuban.Model.layer import Layer
33    
34  import copy  import copy
# Line 164  class TestClassification(unittest.TestCa Line 171  class TestClassification(unittest.TestCa
171          # test SetRange()          # test SetRange()
172          self.assertRaises(ValueError, group.SetRange, 1, 0)          self.assertRaises(ValueError, group.SetRange, 1, 0)
173          group.SetRange(-5, 5)          group.SetRange(-5, 5)
174          self.assertEqual(group.GetRange(), (-5, 5))          self.assertEqual(group.GetRange(), "[-5;5[")
175    
176          # test Matches()          # test Matches()
177          self.assertEqual(group.Matches(-6), False)          self.assertEqual(group.Matches(-6), False)
# Line 255  class TestClassification(unittest.TestCa Line 262  class TestClassification(unittest.TestCa
262          green = Color(0, 1, 0)          green = Color(0, 1, 0)
263          blue  = Color(0, 0, 1)          blue  = Color(0, 0, 1)
264    
265          layer = Layer("asdf", "../Data/iceland/political.dbf")          session = Session("Test session")
266            filename = os.path.join("..", "Data", "iceland", "political.dbf")
267            layer = Layer("asdf", session.OpenShapefile(filename))
268    
269          #          #
270          # init with no params          # init with no params
# Line 307  class TestClassification(unittest.TestCa Line 316  class TestClassification(unittest.TestCa
316          self.assertEquals(c.FindGroup(5), s)          self.assertEquals(c.FindGroup(5), s)
317          self.assertEquals(c.FindGroup(10), c.GetDefaultGroup())          self.assertEquals(c.FindGroup(10), c.GetDefaultGroup())
318    
319            clazz = copy.deepcopy(c)
320    
321            self.assertEquals(clazz.GetNumGroups(), c.GetNumGroups())
322    
323            for i in range(clazz.GetNumGroups()):
324                self.assertEquals(clazz.GetGroup(i), c.GetGroup(i))
325    
326          layer.Destroy()          layer.Destroy()
327    
328  if __name__ == "__main__":  if __name__ == "__main__":

Legend:
Removed from v.618  
changed lines
  Added in v.884

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26