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

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

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

revision 984 by bh, Thu May 22 16:37:48 2003 UTC revision 1039 by bh, Mon May 26 17:31:24 2003 UTC
# Line 29  from Thuban.Model.proj import Projection Line 29  from Thuban.Model.proj import Projection
29  from Thuban.Model.color import Color  from Thuban.Model.color import Color
30  from Thuban.Model.table import MemoryTable, FIELDTYPE_STRING, \  from Thuban.Model.table import MemoryTable, FIELDTYPE_STRING, \
31                                 FIELDTYPE_INT, FIELDTYPE_DOUBLE                                 FIELDTYPE_INT, FIELDTYPE_DOUBLE
32    from Thuban.Model.data import DerivedShapeStore
33    
34    
35  class TestSessionSimple(unittest.TestCase):  class TestSessionSimple(unittest.TestCase):
36    
# Line 69  class TestSessionSimple(unittest.TestCas Line 71  class TestSessionSimple(unittest.TestCas
71          table = session.AddTable(memtable)          table = session.AddTable(memtable)
72          self.assertEquals(session.Tables(), [table])          self.assertEquals(session.Tables(), [table])
73    
74        def test_open_table_file(self):
75            """Test Session.OpenTableFile()"""
76            session = self.session = Session("Test Session")
77            filename = os.path.join("..", "Data", "iceland",
78                                    "roads-line.dbf")
79            table = session.OpenTableFile(filename)
80            self.assertEquals(session.Tables(), [table])
81    
82        def test_remove_table(self):
83            """Test Session.RemoveTable()"""
84            session = self.session = Session("Test Session")
85            memtable = MemoryTable([("type", FIELDTYPE_STRING),
86                                    ("value", FIELDTYPE_DOUBLE),
87                                    ("code", FIELDTYPE_INT)],
88                                   [("OTHER/UNKNOWN", -1.5, 11),
89                                    ("RUINS", 0.0, 1),
90                                    ("FARM", 3.141, 2),
91                                    ("BUILDING", 2.5, 3),
92                                    ("HUT", 1e6, 4),
93                                    ("LIGHTHOUSE", -0.01, 5)])
94            table = session.AddTable(memtable)
95            self.assertEquals(session.Tables(), [table])
96            session.RemoveTable(table)
97            self.assertEquals(session.Tables(), [])
98            self.assertRaises(ValueError, session.RemoveTable, table)
99    
100      def test_open_shapefile(self):      def test_open_shapefile(self):
101          """Test Session.OpenShapefile()"""          """Test Session.OpenShapefile()"""
102          session = self.session = Session("Test Session")          session = self.session = Session("Test Session")
# Line 85  class TestSessionSimple(unittest.TestCas Line 113  class TestSessionSimple(unittest.TestCas
113    
114          self.assertEquals(session.Tables(), [store.Table()])          self.assertEquals(session.Tables(), [store.Table()])
115    
116        def test_add_shapestore(self):
117            """Test Session.AddShapeStore()"""
118            session = self.session = Session("Test Session")
119            filename = os.path.join("..", "Data", "iceland",
120                                    "roads-line.shp")
121            try:
122                store = session.OpenShapefile(filename)
123                derived = DerivedShapeStore(store, store.Table())
124                session.AddShapeStore(derived)
125                self.assertEquals(session.ShapeStores(), [store, derived])
126            finally:
127                store = derived = None
128    
129    
130  class TestSessionBase(unittest.TestCase, support.SubscriberMixin):  class TestSessionBase(unittest.TestCase, support.SubscriberMixin):
131    

Legend:
Removed from v.984  
changed lines
  Added in v.1039

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26