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

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

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

revision 1257 by bh, Fri Jun 20 12:22:25 2003 UTC revision 1664 by bh, Wed Aug 27 15:20:54 2003 UTC
# Line 34  import unittest Line 34  import unittest
34  import support  import support
35  support.initthuban()  support.initthuban()
36    
37    import postgissupport
38  from xmlsupport import sax_eventlist  from xmlsupport import sax_eventlist
39    
40    import dbflib
41    
42  from Thuban.Model.save import save_session  from Thuban.Model.save import save_session
43  from Thuban.Model.load import load_session, parse_color  from Thuban.Model.load import load_session, parse_color, LoadError, \
44  from Thuban.Model.color import Color       LoadCancelled
45    from Thuban.Model.color import Transparent
46  from Thuban.Model.classification import ClassGroupProperties, ClassGroupRange,\  from Thuban.Model.classification import ClassGroupProperties, ClassGroupRange,\
47      ClassGroupSingleton, ClassGroupDefault      ClassGroupSingleton, ClassGroupDefault
48    from Thuban.Model.postgisdb import ConnectionError
49    
50  def filenames_equal(name1, name2):  def filenames_equal(name1, name2):
51      """Return true if the filenames name1 and name2 are equal.      """Return true if the filenames name1 and name2 are equal.
# Line 76  class LoadSessionTest(support.FileLoadTe Line 81  class LoadSessionTest(support.FileLoadTe
81              self.session.Destroy()              self.session.Destroy()
82          self.session = None          self.session = None
83    
84    
85        dtd = "http://thuban.intevation.org/dtds/thuban-0.9.dtd"
86        thubanids = [((dtd, n), (None, "id")) for n in
87                     ["fileshapesource", "filetable", "jointable",
88                      "derivedshapesource"]]
89        thubanidrefs = [((dtd, n), (None, m)) for n, m in
90                        [("layer", "shapestore"),
91                         ("jointable", "left"),
92                         ("jointable", "right"),
93                         ("derivedshapesource", "table"),
94                         ("derivedshapesource", "shapesource")]]
95        del n, m, dtd
96    
97      def check_format(self):      def check_format(self):
98          """Check whether the file we loaded from matches the one that          """Check whether the file we loaded from matches the one that
99          would be written. Call this from each test case after loading          would be written. Call this from each test case after loading
# Line 83  class LoadSessionTest(support.FileLoadTe Line 101  class LoadSessionTest(support.FileLoadTe
101          """          """
102          filename = self.temp_file_name(self.id() + ".roundtrip.thuban")          filename = self.temp_file_name(self.id() + ".roundtrip.thuban")
103          save_session(self.session, filename)          save_session(self.session, filename)
104          el1 = sax_eventlist(filename = filename)          el1 = sax_eventlist(filename = filename, ids = self.thubanids,
105          el2 = sax_eventlist(filename = self.filename())                              idrefs = self.thubanidrefs)
106          self.assertEquals(el1, el2)          el2 = sax_eventlist(filename = self.filename(), ids = self.thubanids,
107                                idrefs = self.thubanidrefs)
108            if 0:
109                for a, b in zip(el1, el2):
110                    print a != b and "***************" or ""
111                    print a
112                    print b
113            self.assertEquals(el1, el2,
114                              "loaded file not equivalent to the saved file")
115    
116    
117  class ClassificationTest(LoadSessionTest):  class ClassificationTest(LoadSessionTest):
# Line 126  class ClassificationTest(LoadSessionTest Line 152  class ClassificationTest(LoadSessionTest
152                  if data[CLASSES][i][GROUP_TYPE] == "default":                  if data[CLASSES][i][GROUP_TYPE] == "default":
153                      g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL])                      g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL])
154                  elif data[CLASSES][i][GROUP_TYPE] == "range":                  elif data[CLASSES][i][GROUP_TYPE] == "range":
155                      g = ClassGroupRange(data[CLASSES][i][GROUP_DATA][0],                      g = ClassGroupRange((data[CLASSES][i][GROUP_DATA][0],
156                                          data[CLASSES][i][GROUP_DATA][1],                                           data[CLASSES][i][GROUP_DATA][1]),
157                                          props, data[CLASSES][i][GROUP_LABEL])                                          props, data[CLASSES][i][GROUP_LABEL])
158                  elif data[CLASSES][i][GROUP_TYPE] == "single":                  elif data[CLASSES][i][GROUP_TYPE] == "single":
159                      g = ClassGroupSingleton(data[CLASSES][i][GROUP_DATA],                      g = ClassGroupSingleton(data[CLASSES][i][GROUP_DATA],
# Line 143  class TestSingleLayer(LoadSessionTest): Line 169  class TestSingleLayer(LoadSessionTest):
169    
170      file_contents = '''\      file_contents = '''\
171  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
172  <!DOCTYPE session SYSTEM "thuban.dtd">  <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
173  <session title="single map&amp;layer">  <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
174          <map title="Test Map">          title="single map&amp;layer">
175                  <projection name="Unknown">      <fileshapesource filetype="shapefile" id="D1"
176                          <parameter value="zone=26"/>          filename="../../Data/iceland/political.shp"/>
177                          <parameter value="proj=utm"/>      <map title="Test Map">
178                          <parameter value="ellps=clrk66"/>          <projection name="Unknown">
179                  </projection>              <parameter value="zone=26"/>
180                  <layer title="My Layer" stroke_width="1" fill="None"              <parameter value="proj=utm"/>
181                      filename="../../Data/iceland/political.shp"              <parameter value="ellps=clrk66"/>
182                      stroke="#000000" visible="true"/>          </projection>
183          </map>          <layer shapestore="D1" visible="true"
184                    stroke="#000000" title="My Layer" stroke_width="1"
185                    fill="None"/>
186        </map>
187  </session>  </session>
188  '''  '''
189    
# Line 187  class TestSingleLayer(LoadSessionTest): Line 216  class TestSingleLayer(LoadSessionTest):
216                                                       os.pardir, os.pardir,                                                       os.pardir, os.pardir,
217                                                       "Data", "iceland",                                                       "Data", "iceland",
218                                                       "political.shp")))                                                       "political.shp")))
219          eq(layer.GetClassification().GetDefaultFill(), Color.Transparent)          eq(layer.GetClassification().GetDefaultFill(), Transparent)
220          eq(layer.GetClassification().GetDefaultLineColor().hex(), "#000000")          eq(layer.GetClassification().GetDefaultLineColor().hex(), "#000000")
221          eq(layer.Visible(), True)          eq(layer.Visible(), True)
222    
# Line 201  class TestLayerVisibility(LoadSessionTes Line 230  class TestLayerVisibility(LoadSessionTes
230    
231      file_contents = '''\      file_contents = '''\
232  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
233  <!DOCTYPE session SYSTEM "thuban.dtd">  <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
234  <session title="single map&amp;layer">  <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
235          <map title="Test Map">          title="single map&amp;layer">
236                  <projection name="Unknown">      <fileshapesource filetype="shapefile" id="D1"
237                          <parameter value="zone=26"/>          filename="../../Data/iceland/political.shp"/>
238                          <parameter value="proj=utm"/>      <map title="Test Map">
239                          <parameter value="ellps=clrk66"/>          <projection name="Unknown">
240                  </projection>              <parameter value="zone=26"/>
241                  <layer title="My Layer" stroke_width="1" fill="None"              <parameter value="proj=utm"/>
242                      filename="../../Data/iceland/political.shp"              <parameter value="ellps=clrk66"/>
243                      stroke="#000000" visible="false">          </projection>
244          </layer>          <layer shapestore="D1" visible="false" stroke="#000000"
245                    title="My Layer" stroke_width="1" fill="None"/>
246      </map>      </map>
247  </session>  </session>
248  '''  '''
# Line 259  class TestClassification(ClassificationT Line 289  class TestClassification(ClassificationT
289                  <clpoint value="1">                  <clpoint value="1">
290                      <cldata stroke="#000000" stroke_width="10" fill="None"/>                      <cldata stroke="#000000" stroke_width="10" fill="None"/>
291                  </clpoint>                  </clpoint>
292                    <clpoint value="\xc3\xa4\xc3\xb6\xc3\xbc"
293                             label="\xc3\x9cml\xc3\xa4uts">
294                        <cldata fill="None" stroke="#000000" stroke_width="1"/>
295                    </clpoint>
296              </classification>              </classification>
297          </layer>          </layer>
298                  <layer title="My Layer 2" stroke_width="1" fill="None"                  <layer title="My Layer 2" stroke_width="1" fill="None"
# Line 293  class TestClassification(ClassificationT Line 327  class TestClassification(ClassificationT
327    
328          map = self.session.Maps()[0] # only one map in the sample          map = self.session.Maps()[0] # only one map in the sample
329    
330          expected = [("My Layer", 2,          expected = [("My Layer", 3,
331                          [("default", (), "",                          [("default", (), "",
332                              ("#000000", 1, "None")),                              ("#000000", 1, "None")),
333                           ("single", "1", "",                           ("single", "1", "",
334                              ("#000000", 2, "None")),                              ("#000000", 2, "None")),
335                           ("single", "1", "",                           ("single", "1", "",
336                              ("#000000", 10, "None"))]),                              ("#000000", 10, "None")),
337                             ("single", "\xe4\xf6\xfc", "\xdcml\xe4uts",
338                                ("#000000", 1, "None"))]),
339                       ("My Layer 2", 4,                       ("My Layer 2", 4,
340                           [("default", (), "",                           [("default", (), "",
341                              ("#000000", 2, "None")),                              ("#000000", 2, "None")),
# Line 319  class TestLabels(ClassificationTest): Line 355  class TestLabels(ClassificationTest):
355    
356      file_contents = '''\      file_contents = '''\
357  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
358  <!DOCTYPE session SYSTEM "thuban.dtd">  <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
359  <session title="single map&amp;layer">  <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
360          <map title="Test Map">          title="single map&amp;layer">
361                  <projection name="Unknown">      <fileshapesource filetype="shapefile" id="D1"
362                          <parameter value="zone=26"/>          filename="../../Data/iceland/political.shp"/>
363                          <parameter value="proj=utm"/>      <map title="Test Map">
364                          <parameter value="ellps=clrk66"/>          <projection name="Unknown">
365                  </projection>              <parameter value="zone=26"/>
366                  <layer title="My Layer" stroke_width="1" fill="None"              <parameter value="proj=utm"/>
367                      filename="../../Data/iceland/political.shp"              <parameter value="ellps=clrk66"/>
368                      stroke="#000000" visible="true">          </projection>
369            <layer shapestore="D1" visible="true" stroke="#000000"
370                    title="My Layer" stroke_width="1" fill="None">
371              <classification field="POPYREG" field_type="string">              <classification field="POPYREG" field_type="string">
372                  <clnull label="hallo">                  <clnull label="hallo">
373                      <cldata stroke="#000000" stroke_width="1" fill="None"/>                      <cldata stroke="#000000" stroke_width="1" fill="None"/>
# Line 365  class TestLayerProjection(LoadSessionTes Line 403  class TestLayerProjection(LoadSessionTes
403    
404      file_contents = '''\      file_contents = '''\
405  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
406  <!DOCTYPE session SYSTEM "thuban.dtd">  <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
407  <session title="single map&amp;layer">  <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
408          <map title="Test Map">          title="single map&amp;layer">
409                  <projection name="Unknown">      <fileshapesource filetype="shapefile" id="D2"
410                          <parameter value="zone=26"/>          filename="../../Data/iceland/roads-line.shp"/>
411                          <parameter value="proj=utm"/>      <fileshapesource filetype="shapefile" id="D4"
412                          <parameter value="ellps=clrk66"/>          filename="../../Data/iceland/political.shp"/>
413                  </projection>      <map title="Test Map">
414                  <layer title="My Layer" stroke_width="1" fill="None"          <projection name="Unknown">
415                      filename="../../Data/iceland/political.shp"              <parameter value="zone=26"/>
416                      stroke="#000000" visible="true">              <parameter value="proj=utm"/>
417                      <projection name="hello">              <parameter value="ellps=clrk66"/>
418                          <parameter value="zone=13"/>          </projection>
419                          <parameter value="proj=tmerc"/>          <layer shapestore="D4" visible="true" stroke="#000000"
420                          <parameter value="ellps=clrk66"/>                  title="My Layer" stroke_width="1" fill="None">
421                      </projection>              <projection name="hello">
422                    <parameter value="zone=13"/>
423                    <parameter value="proj=tmerc"/>
424                    <parameter value="ellps=clrk66"/>
425                </projection>
426              <classification field="POPYREG" field_type="string">              <classification field="POPYREG" field_type="string">
427                  <clnull label="hallo">                  <clnull label="hallo">
428                      <cldata stroke="#000000" stroke_width="1" fill="None"/>                      <cldata stroke="#000000" stroke_width="1" fill="None"/>
# Line 390  class TestLayerProjection(LoadSessionTes Line 432  class TestLayerProjection(LoadSessionTes
432                  </clpoint>                  </clpoint>
433              </classification>              </classification>
434          </layer>          </layer>
435                  <layer title="My Layer" stroke_width="1" fill="None"          <layer shapestore="D2" visible="true" stroke="#000000"
436                      filename="../../Data/iceland/political.shp"                  title="My Layer" stroke_width="1" fill="None">
437                      stroke="#000000" visible="true">              <projection name="Unknown">
438                      <projection name="Unknown">                  <parameter value="proj=lcc"/>
439                          <parameter value="proj=lcc"/>                  <parameter value="ellps=clrk66"/>
440                          <parameter value="ellps=clrk66"/>              </projection>
                     </projection>  
441          </layer>          </layer>
442      </map>      </map>
443  </session>  </session>
# Line 436  class TestRasterLayer(LoadSessionTest): Line 477  class TestRasterLayer(LoadSessionTest):
477    
478      file_contents = '''\      file_contents = '''\
479  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
480  <!DOCTYPE session SYSTEM "thuban.dtd">  <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
481  <session title="single map&amp;layer">  <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
482          <map title="Test Map">          title="single map&amp;layer">
483                  <rasterlayer title="My RasterLayer"      <map title="Test Map">
484                       filename="../../Data/iceland/island.tif"          <rasterlayer visible="false" filename="../../Data/iceland/island.tif"
485                       visible="false">                  title="My RasterLayer"/>
         </rasterlayer>  
486      </map>      </map>
487  </session>  </session>
488  '''  '''
# Line 467  class TestRasterLayer(LoadSessionTest): Line 507  class TestRasterLayer(LoadSessionTest):
507                                                       "island.tif")))                                                       "island.tif")))
508          self.check_format()          self.check_format()
509    
510    
511    class TestJoinedTable(LoadSessionTest):
512    
513        file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
514    <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
515    <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd" title="A Joined Table session">
516        <fileshapesource filetype="shapefile" id="D137227612"
517            filename="../../Data/iceland/roads-line.shp"/>
518        <filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140"
519            title="Some Title"/>
520        <jointable id="D136169900" title="Joined"
521            right="D136171140" left="D137227612"
522            leftcolumn="RDLNTYPE" rightcolumn="RDTYPE"
523            jointype="LEFT OUTER"/>
524        <derivedshapesource table="D136169900" shapesource="D137227612"
525            id="D136170932"/>
526        <map title="Test Map">
527            <layer shapestore="D136170932" visible="true" stroke="#000000"
528                    title="My Layer" stroke_width="1" fill="None"/>
529        </map>
530    </session>
531    '''
532    
533        def setUp(self):
534            """Extend inherited method to create the dbffile for the join"""
535            LoadSessionTest.setUp(self)
536            dbffile = self.temp_file_name("load_joinedtable.dbf")
537            dbf = dbflib.create(dbffile)
538            dbf.add_field("RDTYPE", dbflib.FTInteger, 10, 0)
539            dbf.add_field("TEXT", dbflib.FTString, 10, 0)
540            dbf.write_record(0, {'RDTYPE': 8, "TEXT": "foo"})
541            dbf.write_record(1, {'RDTYPE': 2, "TEXT": "bar"})
542            dbf.write_record(2, {'RDTYPE': 3, "TEXT": "baz"})
543            dbf.close()
544    
545        def test(self):
546            """Test loading a session containing a joined table"""
547            session = load_session(self.filename())
548            self.session = session
549    
550            tables = session.Tables()
551            self.assertEquals(len(tables), 3)
552            # FIXME: The tests shouldn't assume a certain order of the tables
553            self.assertEquals(tables[0].Title(), "Some Title")
554            self.assertEquals(tables[1].Title(), "Joined")
555            self.assertEquals(tables[1].JoinType(), "LEFT OUTER")
556            self.check_format()
557    
558    
559    
560    class TestPostGISLayer(LoadSessionTest):
561    
562        file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
563    <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
564    <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
565            title="unnamed session">
566        <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"
567            dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>
568        <dbshapesource tablename="landmarks" id="D143149420" dbconn="D142684948"/>
569        <map title="unnamed map">
570            <layer shapestore="D143149420" visible="true" stroke="#000000"
571                    title="landmarks" stroke_width="1" fill="None"/>
572        </map>
573    </session>
574    '''
575    
576        def setUp(self):
577            """Extend the inherited method to start the postgis server
578    
579            Furthermore, patch the file contents with the real postgis db
580            information
581            """
582            postgissupport.skip_if_no_postgis()
583            self.server = postgissupport.get_test_server()
584            self.postgisdb = self.server.get_default_static_data_db()
585    
586            self.file_contents = self.__class__.file_contents % {
587                "dbname": self.postgisdb.dbname,
588                "user": self.server.user_name,
589                "port": self.server.port,
590                "host": self.server.host}
591            LoadSessionTest.setUp(self)
592    
593        def test(self):
594            """Test loading a session containing a postgis shapestore"""
595            session = load_session(self.filename())
596            self.session = session
597            connections = session.DBConnections()
598            self.assertEquals(len(connections), 1)
599            conn = connections[0]
600            for attr, value in [("host", self.server.host),
601                                ("port", str(self.server.port)),
602                                ("user", self.server.user_name),
603                                ("dbname", self.postgisdb.dbname)]:
604                self.assertEquals(getattr(conn, attr), value)
605            layer = session.Maps()[0].Layers()[0]
606            self.failUnless(layer.ShapeStore().DBConnection() is conn)
607    
608    
609    class TestPostGISLayerPassword(LoadSessionTest):
610    
611        file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
612    <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
613    <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
614            title="unnamed session">
615        <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"
616            dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>
617        <dbshapesource tablename="landmarks" id="D143149420" dbconn="D142684948"/>
618        <map title="unnamed map">
619            <layer shapestore="D143149420" visible="true" stroke="#000000"
620                    title="landmarks" stroke_width="1" fill="None"/>
621        </map>
622    </session>
623    '''
624    
625        def setUp(self):
626            """Extend the inherited method to start the postgis server
627    
628            Furthermore, patch the file contents with the real postgis db
629            information
630            """
631            postgissupport.skip_if_no_postgis()
632            self.server = postgissupport.get_test_server()
633            self.postgisdb = self.server.get_default_static_data_db()
634    
635            self.file_contents = self.__class__.file_contents % {
636                "dbname": self.postgisdb.dbname,
637                "user": self.server.user_name,
638                "port": self.server.port,
639                "host": self.server.host}
640            LoadSessionTest.setUp(self)
641    
642            self.db_connection_callback_called = False
643            self.server.require_authentication(True)
644    
645        def tearDown(self):
646            """Extend the inherited method to switch off postgresql authentication
647            """
648            self.server.require_authentication(False)
649            LoadSessionTest.tearDown(self)
650    
651        def db_connection_callback(self, params, message):
652            """Implementation of Thuban.Model.hooks.query_db_connection_parameters
653            """
654            self.assertEquals(params,
655                              {"dbname": self.postgisdb.dbname,
656                               "user": self.server.user_name,
657                               "port": str(self.server.port),
658                               "host": self.server.host})
659            self.db_connection_callback_called = True
660            params = params.copy()
661            params["password"] = self.server.user_password
662            return params
663    
664        def test_with_callback(self):
665            """Test loading a session with postgis, authentication and a callback
666            """
667            session = load_session(self.filename(),
668                          db_connection_callback = self.db_connection_callback)
669            self.session = session
670            connections = session.DBConnections()
671            self.assertEquals(len(connections), 1)
672            conn = connections[0]
673            for attr, value in [("host", self.server.host),
674                                ("port", str(self.server.port)),
675                                ("user", self.server.user_name),
676                                ("dbname", self.postgisdb.dbname)]:
677                self.assertEquals(getattr(conn, attr), value)
678            layer = session.Maps()[0].Layers()[0]
679            self.failUnless(layer.ShapeStore().DBConnection() is conn)
680            self.failUnless(self.db_connection_callback_called)
681    
682        def test_without_callback(self):
683            """Test loading a session with postgis, authentication and no callback
684            """
685            # A password is required and there's no callback, so we should
686            # get a ConnectionError
687            self.assertRaises(ConnectionError, load_session, self.filename())
688    
689        def test_cancel(self):
690            """Test loading a session with postgis and cancelling authentication
691            """
692            def cancel(*args):
693                self.db_connection_callback_called = True
694                return None
695    
696            # If the user cancels, i.e. if the callbakc returns None, a
697            # LoadCancelled exception is raised.
698            self.assertRaises(LoadCancelled,
699                              load_session, self.filename(), cancel)
700            self.failUnless(self.db_connection_callback_called)
701    
702    
703    class TestLoadError(LoadSessionTest):
704    
705        file_contents = '''\
706    <?xml version="1.0" encoding="UTF-8"?>
707    <!DOCTYPE session SYSTEM "thuban-0.9.dtd">
708    <session xmlns="http://thuban.intevation.org/dtds/thuban-0.9.dtd"
709            title="single map&amp;layer">
710        <fileshapesource id="D1" filename="../../Data/iceland/political.shp"/>
711        <map title="Test Map">
712            <projection name="Unknown">
713                <parameter value="zone=26"/>
714                <parameter value="proj=utm"/>
715                <parameter value="ellps=clrk66"/>
716            </projection>
717            <layer shapestore="D1" visible="true"
718                    stroke="#000000" title="My Layer" stroke_width="1"
719                    fill="None"/>
720        </map>
721    </session>
722    '''
723    
724        def test(self):
725            """Test loading a session missing a required attribute"""
726            # Don't use assertRaises to make sure that if a session is
727            # actually returned it gets destroyed properly.
728            try:
729                self.session = load_session(self.filename())
730            except LoadError, value:
731                # Check the actual messge in value to make sure the
732                # LoadError really was about the missing attribute
733                self.assertEquals(str(value),
734                  "Element "
735                  "(u'http://thuban.intevation.org/dtds/thuban-0.9.dtd',"
736                  " u'fileshapesource') requires an attribute 'filetype'")
737            else:
738                self.fail("Missing filetype attribute doesn't raise LoadError")
739    
740  if __name__ == "__main__":  if __name__ == "__main__":
741      unittest.main()      unittest.main()

Legend:
Removed from v.1257  
changed lines
  Added in v.1664

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26