]> gitweb.michael.orlitzky.com - dead/census-tools.git/blob - src/Tests/Unit/KMLTest.py
Added the KMLTest module containing the LineString tests.
[dead/census-tools.git] / src / Tests / Unit / KMLTest.py
1 import unittest
2
3 import Tests.Fixtures
4 from KML import *
5
6
7 class LineStringTest(unittest.TestCase):
8
9 def testTuplesFromKml(self):
10 """
11 Make sure we parse KML LineStrings into tuples properly.
12 """
13
14 fixture_path = Tests.Fixtures.Path() + '/KML/linestring1.kml'
15 f = open(fixture_path, 'r')
16 kml = f.read()
17 f.close()
18
19 actual_tuples = LineString.tuples_from_kml(kml)
20
21 expected_tuples = [ (-76.62861599999999, 39.315609),
22 (-76.62606, 39.312859),
23 (-76.62496899999999, 39.311951),
24 (-76.624062, 39.31134),
25 (-76.620209, 39.30901),
26 (-76.61734, 39.307499),
27 (-76.616272, 39.306782),
28 (-76.61550099999999, 39.30632),
29 (-76.614952, 39.306091),
30 (-76.614441, 39.305962),
31 (-76.613983, 39.305908),
32 (-76.613152, 39.305939),
33 (-76.612534, 39.305889),
34 (-76.612038, 39.30571) ]
35
36 self.assertEqual(expected_tuples, actual_tuples)
37
38
39 def suite():
40 suite = unittest.TestSuite()
41 suite.addTest(unittest.makeSuite(LineStringTest))
42 return suite