Package sabx10 :: Package oxm :: Module ride_test
[hide private]
[frames] | no frames]

Source Code for Module sabx10.oxm.ride_test

 1  #! /usr/bin/python 
 2  ############################################################################### 
 3  # 
 4  # sabx10.oxm - an SABX file manipulation library 
 5  # Copyright (C) 2009, 2010 Jay Farrimond (jay@sabikerides.com) 
 6  # 
 7  # This file is part of sabx10.oxm. 
 8  # 
 9  # sabx10.oxm is free software: you can redistribute it and/or modify it under 
10  # the terms of the GNU Lesser General Public License as published by the Free 
11  # Software Foundation, either version 3 of the License, or (at your option) any 
12  # later version. 
13  # 
14  # sabx10.oxm is distributed in the hope that it will be useful, but WITHOUT ANY 
15  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
16  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
17  # details. 
18  # 
19  # You should have received a copy of the GNU Lesser General Public License 
20  # along with sabx10.oxm.  If not, see <http://www.gnu.org/licenses/>. 
21  # 
22  ############################################################################### 
23   
24  import os 
25  import tempfile 
26  import unittest 
27   
28  from utils import parse_no_def_namespaces 
29   
30  from parse_test_data import test_data 
31  from ride import * 
32   
33 -class TestProcess(unittest.TestCase):
34
35 - def setUp(self):
36 file_valid = tempfile.TemporaryFile(mode='w+') 37 file_valid.write(test_data) 38 file_valid.seek(0, os.SEEK_SET) 39 self.tree = parse_no_def_namespaces(file_valid)
40
41 - def test_process_rides(self):
42 rides, bounds = process_rides(self.tree) 43 44 self.assertEquals(len(rides), 4) 45 self.assertEquals(len(rides[0].turns), 18) 46 self.assertEquals(len(rides[0].segs), 18) 47 self.assertEquals(len(rides[0].pois), 1) 48 self.assertEquals(len(rides[0].stops), 5) 49 self.assertEquals(rides[0].index, 0)
50 51 if __name__ == "__main__": 52 unittest.main() 53