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

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

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

revision 1827 by bh, Tue Oct 14 16:04:35 2003 UTC revision 1831 by bh, Thu Oct 16 16:36:11 2003 UTC
# Line 133  class TestProjFileSimple: Line 133  class TestProjFileSimple:
133    
134  class TestProjFile(unittest.TestCase, support.SubscriberMixin):  class TestProjFile(unittest.TestCase, support.SubscriberMixin):
135    
136      """Test cases for reading and writing projection files.      """Test cases for ProjFile objects"""
     """  
137    
138      def setUp(self):      def setUp(self):
139          self.clear_messages()          self.clear_messages()
# Line 208  class ProjFileTest(unittest.TestCase, su Line 207  class ProjFileTest(unittest.TestCase, su
207    
208  class ProjFileReadTests(ProjFileTest):  class ProjFileReadTests(ProjFileTest):
209    
210      """Test read ProjFile objects from files"""      """Test read ProjFile objects from files
211    
212        The files only cover error handling and the system projection file.
213        """
214    
215      def test_read_non_existing_file(self):      def test_read_non_existing_file(self):
216          """Test read_proj_file with non-existing file"""          """Test read_proj_file with non-existing file"""
# Line 247  class ProjFileReadTests(ProjFileTest): Line 249  class ProjFileReadTests(ProjFileTest):
249          self.assertEquals(warnings, [])          self.assertEquals(warnings, [])
250          self.assert_(len(projfile.GetProjections()) > 0)          self.assert_(len(projfile.GetProjections()) > 0)
251    
252            # see whether it got cached and we get the same projfile object
253            # when we read the file again
254            projfile2, warnings = resource.get_system_proj_file()
255            self.assert_(projfile is projfile2)
256    
257    
258  class WriteProjFileTests(ProjFileTest):  class WriteProjFileTests(ProjFileTest):
259    
# Line 315  class WriteProjFileTests(ProjFileTest): Line 322  class WriteProjFileTests(ProjFileTest):
322          self.doTestWrite(pf, file_contents)          self.doTestWrite(pf, file_contents)
323    
324    
325  class TestLoadingProjFile(support.FileLoadTestCase):  class ProjFileLoadTestCase(support.FileLoadTestCase):
326    
327        """Base class for the test cases that read specific test files"""
328    
329      file_extension = ".proj"      file_extension = ".proj"
330    
331        def tearDown(self):
332            """Clear the cache explicitly"""
333            resource.clear_proj_file_cache()
334    
335    
336    class TestLoadingProjFile(ProjFileLoadTestCase):
337    
338      file_contents = '''\      file_contents = '''\
339  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
340  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">
# Line 369  class TestLoadingProjFile(support.FileLo Line 386  class TestLoadingProjFile(support.FileLo
386                                 "proj=tmerc", "units=m",                                 "proj=tmerc", "units=m",
387                                 "x_0=400000.000", "y_0=0.000"])                                 "x_0=400000.000", "y_0=0.000"])
388    
389        def test_caching(self):
390            # test whether the projfile cache works
391            projfile, warnings = resource.read_proj_file(self.filename())
392            projfile2, warnings = resource.read_proj_file(self.filename())
393    
394  class TestLoadingProjFileWithEmptyProjectionlist(support.FileLoadTestCase):          # Both projfiles should be the same object
395            self.assert_(projfile2 is projfile)
396    
397            # If we clear the cache we should get a new one.
398            resource.clear_proj_file_cache()
399            projfile3, warnings = resource.read_proj_file(self.filename())
400            self.assert_(projfile3 is not projfile)
401    
402    
403    class TestLoadingProjFileWithEmptyProjectionlist(ProjFileLoadTestCase):
404    
     file_extension = ".proj"  
405      file_contents = '''\      file_contents = '''\
406  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
407  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">
# Line 389  class TestLoadingProjFileWithEmptyProjec Line 418  class TestLoadingProjFileWithEmptyProjec
418          self.assertEquals(len(projfile.GetProjections()), 0)          self.assertEquals(len(projfile.GetProjections()), 0)
419    
420    
421  class TestProjFileWithInvalidParameters(unittest.TestCase,  class TestProjFileWithInvalidParameters(ProjFileLoadTestCase):
                                         support.FileLoadTestCase):  
422    
     file_extension = ".proj"  
423      file_contents = '''\      file_contents = '''\
424  <?xml version="1.0" encoding="UTF-8"?>  <?xml version="1.0" encoding="UTF-8"?>
425  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">  <!DOCTYPE projectionlist SYSTEM "projfile.dtd">

Legend:
Removed from v.1827  
changed lines
  Added in v.1831

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26