/[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 2036 by bh, Mon Dec 22 17:49:43 2003 UTC revision 2104 by bh, Fri Mar 12 12:19:15 2004 UTC
# Line 1  Line 1 
1  # Copyright (c) 2002, 2003 by Intevation GmbH  # Copyright (c) 2002, 2003, 2004 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 16  files created by Thuban 0.2. Line 16  files created by Thuban 0.2.
16  Maintenance of the test cases:  Maintenance of the test cases:
17    
18  When during a development period the file format is changed with respect  When during a development period the file format is changed with respect
19  to the last released version for the first, the tests here should be  to the last released version for the first time, the tests here should
20  copied to the version specific test file. The round-trip tests which  be copied to the version specific test file.  The round-trip tests which
21  save the session again and compare the XML files should not be copied  save the session again and compare the XML files should not be copied
22  over as they only make sense here to make sure th that the files checked  over as they only make sense here to make sure th that the files checked
23  here are actually ones that may have been written by the current thuban  here are actually ones that may have been written by the current thuban
# Line 89  class LoadSessionTest(support.FileLoadTe Line 89  class LoadSessionTest(support.FileLoadTe
89          self.session = None          self.session = None
90    
91    
92      dtd = "http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"      dtd = "http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
93      thubanids = [((dtd, n), (None, "id")) for n in      thubanids = [((dtd, n), (None, "id")) for n in
94                   ["fileshapesource", "filetable", "jointable",                   ["fileshapesource", "filetable", "jointable",
95                    "derivedshapesource"]]                    "derivedshapesource"]]
# Line 185  class TestSingleLayer(LoadSessionTest): Line 185  class TestSingleLayer(LoadSessionTest):
185      # want to test whether the loading code handles that correctly.      # want to test whether the loading code handles that correctly.
186      file_contents = '''\      file_contents = '''\
187  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
188  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
189  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
190          title="Stra\xc3\x9fen &amp; Landmarken">          title="Stra\xc3\x9fen &amp; Landmarken">
191      <fileshapesource filetype="shapefile" id="D1"      <fileshapesource filetype="shapefile" id="D1"
192          filename="../../Data/iceland/political.shp"/>          filename="../../Data/iceland/political.shp"/>
# Line 277  class TestNonAsciiColumnName(LoadSession Line 277  class TestNonAsciiColumnName(LoadSession
277    
278      file_contents = '''\      file_contents = '''\
279  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
280  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
281  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
282          title="Non ASCII column name test">          title="Non ASCII column name test">
283      <fileshapesource filetype="shapefile" id="D1"      <fileshapesource filetype="shapefile" id="D1"
284          filename="TestNonAsciiColumnName.shp"/>          filename="TestNonAsciiColumnName.shp"/>
# Line 354  class TestLayerVisibility(LoadSessionTes Line 354  class TestLayerVisibility(LoadSessionTes
354    
355      file_contents = '''\      file_contents = '''\
356  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
357  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
358  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
359          title="single map&amp;layer">          title="single map&amp;layer">
360      <fileshapesource filetype="shapefile" id="D1"      <fileshapesource filetype="shapefile" id="D1"
361          filename="../../Data/iceland/political.shp"/>          filename="../../Data/iceland/political.shp"/>
# Line 392  class TestClassification(ClassificationT Line 392  class TestClassification(ClassificationT
392    
393      file_contents = '''\      file_contents = '''\
394  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
395  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
396  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
397          title="single map&amp;layer">          title="single map&amp;layer">
398      <fileshapesource filetype="shapefile" id="D138389860"      <fileshapesource filetype="shapefile" id="D138389860"
399          filename="../../Data/iceland/political.shp"/>          filename="../../Data/iceland/political.shp"/>
# Line 484  class TestLabels(ClassificationTest): Line 484  class TestLabels(ClassificationTest):
484    
485      file_contents = '''\      file_contents = '''\
486  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
487  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
488  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
489          title="single map&amp;layer">          title="single map&amp;layer">
490      <fileshapesource filetype="shapefile" id="D1"      <fileshapesource filetype="shapefile" id="D1"
491          filename="../../Data/iceland/political.shp"/>          filename="../../Data/iceland/political.shp"/>
# Line 532  class TestLayerProjection(LoadSessionTes Line 532  class TestLayerProjection(LoadSessionTes
532    
533      file_contents = '''\      file_contents = '''\
534  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
535  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
536  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
537          title="single map&amp;layer">          title="single map&amp;layer">
538      <fileshapesource filetype="shapefile" id="D2"      <fileshapesource filetype="shapefile" id="D2"
539          filename="../../Data/iceland/roads-line.shp"/>          filename="../../Data/iceland/roads-line.shp"/>
# Line 610  class TestRasterLayer(LoadSessionTest): Line 610  class TestRasterLayer(LoadSessionTest):
610    
611      file_contents = '''\      file_contents = '''\
612  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
613  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
614  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
615          title="single map&amp;layer">          title="single map&amp;layer">
616      <map title="Test Map">      <map title="Test Map">
617          <rasterlayer visible="false" filename="../../Data/iceland/island.tif"          <rasterlayer visible="false" filename="../../Data/iceland/island.tif"
# Line 644  class TestRasterLayer(LoadSessionTest): Line 644  class TestRasterLayer(LoadSessionTest):
644  class TestJoinedTable(LoadSessionTest):  class TestJoinedTable(LoadSessionTest):
645    
646      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
647  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
648  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" title="A Joined Table session">  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="A Joined Table session">
649      <fileshapesource filetype="shapefile" id="D137227612"      <fileshapesource filetype="shapefile" id="D137227612"
650          filename="../../Data/iceland/roads-line.shp"/>          filename="../../Data/iceland/roads-line.shp"/>
651      <filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140"      <filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140"
# Line 695  class TestLabelLayer(LoadSessionTest): Line 695  class TestLabelLayer(LoadSessionTest):
695      # test whether they're supported correctly.      # test whether they're supported correctly.
696    
697      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
698  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
699  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" title="Thuban sample session">  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="Thuban sample session">
700      <fileshapesource filetype="shapefile" id="D145265052"      <fileshapesource filetype="shapefile" id="D145265052"
701          filename="../../Data/iceland/political.shp"/>          filename="../../Data/iceland/political.shp"/>
702      <fileshapesource filetype="shapefile" id="D145412868"      <fileshapesource filetype="shapefile" id="D145412868"
# Line 752  class TestLabelLayer(LoadSessionTest): Line 752  class TestLabelLayer(LoadSessionTest):
752  class TestPostGISLayer(LoadSessionTest):  class TestPostGISLayer(LoadSessionTest):
753    
754      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
755  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
756  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
757          title="unnamed session">          title="unnamed session">
758      <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"      <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"
759          dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>          dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>
760      <dbshapesource tablename="landmarks" id="D143149420" dbconn="D142684948"/>      <dbshapesource id="D143149420" dbconn="D142684948"
761            tablename="landmarks_point_id" id_column="point_id"
762            geometry_column="the_geom" />
763      <map title="unnamed map">      <map title="unnamed map">
764          <layer shapestore="D143149420" visible="true" stroke="#000000"          <layer shapestore="D143149420" visible="true" stroke="#000000"
765                  title="landmarks" stroke_width="1" fill="None"/>                  title="landmarks" stroke_width="1" fill="None"/>
# Line 801  class TestPostGISLayer(LoadSessionTest): Line 803  class TestPostGISLayer(LoadSessionTest):
803  class TestPostGISLayerPassword(LoadSessionTest):  class TestPostGISLayerPassword(LoadSessionTest):
804    
805      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>      file_contents = '''<?xml version="1.0" encoding="UTF-8"?>
806  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
807  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
808          title="unnamed session">          title="unnamed session">
809      <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"      <dbconnection port="%(port)s" host="%(host)s" user="%(user)s"
810          dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>          dbtype="postgis" id="D142684948" dbname="%(dbname)s"/>
# Line 896  class TestLoadError(LoadSessionTest): Line 898  class TestLoadError(LoadSessionTest):
898    
899      file_contents = '''\      file_contents = '''\
900  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
901  <!DOCTYPE session SYSTEM "thuban-1.0.dtd">  <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
902  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd"  <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
903          title="single map&amp;layer">          title="single map&amp;layer">
904      <fileshapesource id="D1" filename="../../Data/iceland/political.shp"/>      <fileshapesource id="D1" filename="../../Data/iceland/political.shp"/>
905      <map title="Test Map">      <map title="Test Map">
# Line 924  class TestLoadError(LoadSessionTest): Line 926  class TestLoadError(LoadSessionTest):
926              # LoadError really was about the missing attribute              # LoadError really was about the missing attribute
927              self.assertEquals(str(value),              self.assertEquals(str(value),
928                "Element "                "Element "
929                "(u'http://thuban.intevation.org/dtds/thuban-1.0.0.dtd',"                "(u'http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd',"
930                " u'fileshapesource') requires an attribute 'filetype'")                " u'fileshapesource') requires an attribute 'filetype'")
931          else:          else:
932              self.fail("Missing filetype attribute doesn't raise LoadError")              self.fail("Missing filetype attribute doesn't raise LoadError")

Legend:
Removed from v.2036  
changed lines
  Added in v.2104

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26