source: TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/tests/OGLinearRing_Test.py @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/tests/OGLinearRing_Test.py@2194
Revision 2194, 2.0 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

Line 
1
2################################################################################
3# Copyright (c) QinetiQ Plc 2003
4#
5# Licensed under the LGPL. For full license details see the LICENSE file.
6################################################################################
7
8import unittest
9import os
10
11import TestConfig
12
13if not os.environ.get('USECOVERAGE') == '1':
14    import _OGLinearRing
15    from _OGLinearRing import *
16
17from _OGGeometry import OGGeometry
18from _OGPoint import OGPoint, OGpointFromValues
19
20class OGLinearRingTest(unittest.TestCase):   
21    def testFactoryMethods(self):
22        linearring = OGlinearRingFromOGPoints(OGpointFromValues(1.0,2.0),
23                                              OGpointFromValues(2.0,3.0))
24        assert len(linearring) == 2
25               
26        linearring = OGlinearRingFromSequence(((1.0,2.0),(2.0,3.0)))
27        assert len(linearring) == 2
28
29        assert repr(linearring) == '(1.000000 2.000000,2.000000 3.000000)', repr(linearring)
30       
31    def testzzz_CoverageAssertion(self):
32            try:
33                coverage.stop()
34            except:
35                return 1
36
37            x = coverage.analysis(_OGLinearRing)
38            assert x[2]==[], "Coverage is less than 100%"
39
40
41def testSuite():
42    return unittest.makeSuite(OGLinearRingTest,'test')
43
44if __name__ == "__main__":
45    if os.environ.get('USECOVERAGE') == '1':
46        try:
47            import coverage
48            coverage.erase()
49            coverage.start()
50            COVERAGE = 1
51            import _OGLinearRing
52            from _OGLinearRing import *
53
54        except:
55            print "Error setting up coverage checking"
56            COVERAGE = 0
57    else:
58        COVERAGE = 0
59
60    if os.environ.get('USEPYCHECK') == '1':
61        try:
62            import pychecker.checker
63        except:
64            print "Pychecker not installed on this machine"
65
66    unittest.TextTestRunner().run(testSuite())
67
68    if COVERAGE:
69        coverage.stop()
70        x = coverage.analysis(_OGLinearRing)
71        print "\n"
72        coverage.report(_OGLinearRing)
Note: See TracBrowser for help on using the repository browser.