/[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 1831 by bh, Thu Oct 16 16:36:11 2003 UTC revision 1982 by bh, Thu Nov 27 15:25:34 2003 UTC
# Line 55  class TestProjection(unittest.TestCase, Line 55  class TestProjection(unittest.TestCase,
55                                   (3620891.3077618643, 0.0,                                   (3620891.3077618643, 0.0,
56                                    3875381.8535437919, 252962.10480170773),                                    3875381.8535437919, 252962.10480170773),
57                                   epsilon = 1e-5)                                   epsilon = 1e-5)
58            self.assertFloatSeqEqual(proj.InverseBBox((3620891.3077618643, 0.0,
59                                                       3875381.8535437919,
60                                                       252962.10480170773)),
61                                     (-0.018341599754143501, 0.0,
62                                      2.017992992681688, 2.0377390677846736),
63                                     epsilon = 1e-5)
64    
65          # GetName()          # GetName()
66          self.assertEquals(proj.GetName(), _("Unknown"))          self.assertEquals(proj.GetName(), _("Unknown"))
# Line 80  class TestProjection(unittest.TestCase, Line 86  class TestProjection(unittest.TestCase,
86          self.assertEquals(proj.GetParameter("south"), "south")          self.assertEquals(proj.GetParameter("south"), "south")
87    
88      def test_get_projection_units_geo(self):      def test_get_projection_units_geo(self):
89          """Test Projection.GetProjectedUnits() for geographic projection"""          """Test Projection.GetProjectedUnits() for geographic projection.
90            Test for the alias 'longlat' as well.
91            """
92          proj = Projection(["proj=latlong", "to_meter=0.017453292519943295",          proj = Projection(["proj=latlong", "to_meter=0.017453292519943295",
93                             "ellps=clrk66"])                             "ellps=clrk66"])
94          self.assertEquals(proj.GetProjectedUnits(), PROJ_UNITS_DEGREES)          self.assertEquals(proj.GetProjectedUnits(), PROJ_UNITS_DEGREES)
95            proj = Projection(["proj=longlat", "to_meter=0.017453292519943295",
96                               "ellps=clrk66"])
97            self.assertEquals(proj.GetProjectedUnits(), PROJ_UNITS_DEGREES)
98    
99      def test_get_projection_units_normal(self):      def test_get_projection_units_normal(self):
100          """Test Projection.GetProjectedUnits() for normal projection"""          """Test Projection.GetProjectedUnits() for normal projection"""
# Line 224  class ProjFileReadTests(ProjFileTest): Line 235  class ProjFileReadTests(ProjFileTest):
235          As currently written this only works on unix-like systems and          As currently written this only works on unix-like systems and
236          not e.g. on MS Windows.          not e.g. on MS Windows.
237          """          """
238            if os.name != "posix":
239                raise support.SkipTest("Test only works on posix systems")
240          filename = self.filename()          filename = self.filename()
241          file = open(filename, "w")          file = open(filename, "w")
242          file.close()          file.close()
# Line 239  class ProjFileReadTests(ProjFileTest): Line 252  class ProjFileReadTests(ProjFileTest):
252          self.assertRaises(SAXParseException, resource.read_proj_file, filename)          self.assertRaises(SAXParseException, resource.read_proj_file, filename)
253    
254      def test_get_system_proj_file(self):      def test_get_system_proj_file(self):
255          """Test resource.get_system_proj_file()          """Test resource.get_system_proj_file(DEFAULT_PROJ_FILE)
256    
257          This is primarily to test whether the system proj file contains          This is primarily to test whether the system proj file contains
258          invalid projection paramers and whether the proj file is not          invalid projection paramers and whether the proj file is not
259          empty          empty
260          """          """
261          projfile, warnings = resource.get_system_proj_file()          projfile, warnings\
262                      = resource.get_system_proj_file(resource.DEFAULT_PROJ_FILE)
263          self.assertEquals(warnings, [])          self.assertEquals(warnings, [])
264          self.assert_(len(projfile.GetProjections()) > 0)          self.assert_(len(projfile.GetProjections()) > 0)
265    
266          # see whether it got cached and we get the same projfile object          # see whether it got cached and we get the same projfile object
267          # when we read the file again          # when we read the file again
268          projfile2, warnings = resource.get_system_proj_file()          projfile2, warnings \
269                       = resource.get_system_proj_file(resource.DEFAULT_PROJ_FILE)
270          self.assert_(projfile is projfile2)          self.assert_(projfile is projfile2)
271    
272    

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26