/[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 714 by jonathan, Wed Apr 23 08:47:05 2003 UTC revision 719 by jonathan, Wed Apr 23 10:40:00 2003 UTC
# Line 14  __version__ = "$Revision$" Line 14  __version__ = "$Revision$"
14  # $Id$  # $Id$
15    
16  import unittest  import unittest
17    import os
18    
19  import support  import support
20  support.initthuban()  support.initthuban()
# Line 24  import Thuban.Model.resource as resource Line 25  import Thuban.Model.resource as resource
25    
26  from test_save import sax_eventlist  from test_save import sax_eventlist
27    
28    from xml.sax import SAXParseException
29    
30    
31  class TestProjection(unittest.TestCase, support.FloatComparisonMixin):  class TestProjection(unittest.TestCase, support.FloatComparisonMixin):
32    
# Line 117  class TestProjFile(unittest.TestCase, su Line 120  class TestProjFile(unittest.TestCase, su
120          self.doTestRead(sample_projfile_data, sample_projfile)          self.doTestRead(sample_projfile_data, sample_projfile)
121          self.doTestRead(sample_projfile_data2, sample_projfile2)          self.doTestRead(sample_projfile_data2, sample_projfile2)
122    
123            #
124            # file doesn't exist
125            #
126            self.assertRaises(IOError,
127                resource.ReadProjFile, self.temp_file_name("nonexistent.proj"))
128    
129            #
130            # file isn't readable
131            #
132            filename = self.temp_file_name("projfile.proj")
133            file = open(filename, "w")
134            file.close()
135            os.chmod(filename, 0200) # write-only
136            self.assertRaises(IOError, resource.ReadProjFile, filename)
137            os.chmod(filename, 0600) # read/write so we reuse the file
138    
139            #
140            # file has invalid XML (or none at all)
141            #
142            filename = self.temp_file_name("projfile.proj")
143            file = open(filename, "w")
144            file.close()
145    
146            self.assertRaises(SAXParseException, resource.ReadProjFile, filename)
147    
148      def testWrite(self):      def testWrite(self):
149          """Test WriteProjFile"""          """Test WriteProjFile"""
150    

Legend:
Removed from v.714  
changed lines
  Added in v.719

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26