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

Annotation of /branches/WIP-pyshapelib-bramz/test/test_mockgeo.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1585 - (hide annotations)
Fri Aug 15 10:26:40 2003 UTC (21 years, 6 months ago) by bh
Original Path: trunk/thuban/test/test_mockgeo.py
File MIME type: text/x-python
File size: 1587 byte(s)
Move some of the mock objects in test_baserenderer into their own
module so they can easily be used from other tests

* test/mockgeo.py: New test helper module with some mock objects
for geometry related things like shapes, shapestores and
projections.

* test/test_mockgeo.py: New. Tests for the new helper module

* test/test_baserenderer.py: Some of the mock-objects are in mockgeo now.

1 bh 1585 # Copyright (C) 2003 by Intevation GmbH
2     # Authors:
3     # Bernhard Herzog <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with the software for details.
7    
8     """Test cases for the mockgeo helper objects"""
9    
10     __version__ = "$Revision$"
11     # $Source$
12     # $Id$
13    
14     import unittest
15    
16     import mockgeo
17    
18     import support
19    
20     class TestAffineProjection(unittest.TestCase, support.FloatComparisonMixin):
21    
22     def test_forward(self):
23     """Test AffineProjection.Forward()"""
24     proj = mockgeo.AffineProjection((0.25, 0.1, 2, 0.125, 100.75, 123.25))
25     self.assertEquals(proj.Forward(0, 0), (100.75, 123.25))
26     self.assertEquals(proj.Forward(10.0, 20.0), (143.25, 126.75))
27     self.assertEquals(proj.Forward(30, 0.125), (108.5, 126.265625))
28    
29     def test_inverse(self):
30     """Test AffineProjection.Inverse()"""
31     proj = mockgeo.AffineProjection((0.25, 0.1, 2, 0.125, 100.75, 123.25))
32     self.assertEquals(proj.Inverse(100.75, 123.25), (0, 0))
33     self.assertEquals(proj.Inverse(143.25, 126.75), (10.0, 20.0))
34     self.assertFloatSeqEqual(proj.Inverse(108.5, 126.265625), (30, 0.125))
35    
36     def test_int_coeff(self):
37     """Test AffineProjection with integer coefficients"""
38     proj = mockgeo.AffineProjection((1, 1, -1, 1, 0, 0))
39     # The determinant is an int too but must be treated as a float
40     # when dividing by it otherwise some coefficients in the inverse
41     # become wrong.
42     self.assertEquals(proj.Inverse(10, 10), (10, 0))
43    
44    
45    
46     if __name__ == "__main__":
47     support.run_tests()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26