Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(111)

Delta Between Two Patch Sets: python/test/testtransitfeed.py

Issue 75063: Adding validation for uniqueness of service_id X date in calendar_dates SVN Base: http://googletransitdatafeed.googlecode.com/svn/trunk/
Left Patch Set: Setting context of warning Created 1 month, 1 week ago
Right Patch Set: Removing unnecessary linebreak Created 1 month, 1 week ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #!/usr/bin/python2.5 1 #!/usr/bin/python2.5
2 2
3 # Copyright (C) 2007 Google Inc. 3 # Copyright (C) 2007 Google Inc.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 3207
3208 3208
3209 class OnlyCalendarDatesTestCase(LoadTestCase): 3209 class OnlyCalendarDatesTestCase(LoadTestCase):
3210 def runTest(self): 3210 def runTest(self):
3211 self.Load('only_calendar_dates'), 3211 self.Load('only_calendar_dates'),
3212 self.problems.AssertNoMoreExceptions() 3212 self.problems.AssertNoMoreExceptions()
3213 3213
3214 3214
3215 class DuplicateServiceIdDateWarningTestCase(MemoryZipTestCase): 3215 class DuplicateServiceIdDateWarningTestCase(MemoryZipTestCase):
3216 def runTest(self): 3216 def runTest(self):
3217 # Two lines with the same value of service_id and date.A badly formatted end _date used to generate an InvalidValue report from 3217 # Two lines with the same value of service_id and date.
3218 # Test for the warning. 3218 # Test for the warning.
3219 self.zip.writestr( 3219 self.zip.writestr(
3220 'calendar_dates.txt', 3220 'calendar_dates.txt',
3221 'service_id,date,exception_type\n' 3221 'service_id,date,exception_type\n'
3222 'FULLW,20100604,1\n' 3222 'FULLW,20100604,1\n'
3223 'FULLW,20100604,2\n') 3223 'FULLW,20100604,2\n')
3224 schedule = self.loader.Load() 3224 schedule = self.loader.Load()
3225 e = self.problems.PopException('DuplicateID') 3225 e = self.problems.PopException('DuplicateID')
3226 self.assertEquals('(service_id, date)', e.column_name) 3226 self.assertEquals('(service_id, date)', e.column_name)
3227 self.assertEquals('(FULLW, 20100604)', e.value) 3227 self.assertEquals('(FULLW, 20100604)', e.value)
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
4396 stoptimes = self.trip1.GetStopTimes() 4396 stoptimes = self.trip1.GetStopTimes()
4397 for stoptimes_clone in stoptimes_list: 4397 for stoptimes_clone in stoptimes_list:
4398 self.assertEqual(len(stoptimes_clone), len(stoptimes)) 4398 self.assertEqual(len(stoptimes_clone), len(stoptimes))
4399 for st_clone, st in zip(stoptimes_clone, stoptimes): 4399 for st_clone, st in zip(stoptimes_clone, stoptimes):
4400 for name in st.__slots__: 4400 for name in st.__slots__:
4401 if name not in ('arrival_secs', 'departure_secs'): 4401 if name not in ('arrival_secs', 'departure_secs'):
4402 self.assertEqual(getattr(st, name), getattr(st_clone, name)) 4402 self.assertEqual(getattr(st, name), getattr(st_clone, name))
4403 4403
4404 if __name__ == '__main__': 4404 if __name__ == '__main__':
4405 unittest.main() 4405 unittest.main()
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497