Please review this change that fixes a RuntimeException when an unknown location_type is found in ...
15 years, 9 months ago
(2008-12-15 19:36:09 UTC)
#1
Please review this change that fixes a RuntimeException when an unknown
location_type is found in the stop hierarchy validation. This now allows this to
pass, as the Stop.SetAndCheckAttr function will warn about the invalid type.
I am fixing this because even if the validator finds a bad value, it should just
report it and keep processing, rather than completely failing.
http://codereview.appspot.com/11051/diff/1/2 File python/test/testtransitfeed.py (right): http://codereview.appspot.com/11051/diff/1/2#newcode1262 Line 1262: "BADLOCATION,Airport Bad Location,36.868446,-116.784582,2,\n" Shorter is better: give STATION ...
15 years, 9 months ago
(2008-12-15 20:48:43 UTC)
#2
http://codereview.appspot.com/11051/diff/1/2
File python/test/testtransitfeed.py (right):
http://codereview.appspot.com/11051/diff/1/2#newcode1262
Line 1262: "BADLOCATION,Airport Bad Location,36.868446,-116.784582,2,\n"
Shorter is better: give STATION a bad location_type and remove BADLOCATION,
BULLFROG, STAGECOACH
http://codereview.appspot.com/11051/diff/1/3
File python/transitfeed.py (right):
http://codereview.appspot.com/11051/diff/1/3#newcode3055
Line 3055: elif (stop.location_type not in [0,1] or
Instead of having a negative match and an extra branch how about making the else
on 3060
elif stop.location_type in (0, 1) and other_stop.location_type in (0, 1):
so that the conditions are consistent. location_type not in (0,1) will not match
any conditon and drop off the bottom.
Stop._CheckAndSetAttr use a tuple (0, 1) instead of list for valid
location_type. I don't think we want to factor out the list of valid types
because we might want a valid type that isn't checked for proximity.
I have updated with Tom's suggestions. http://codereview.appspot.com/11051/diff/1/2 File python/test/testtransitfeed.py (right): http://codereview.appspot.com/11051/diff/1/2#newcode1262 Line 1262: "BADLOCATION,Airport Bad ...
15 years, 9 months ago
(2008-12-16 00:20:10 UTC)
#3
I have updated with Tom's suggestions.
http://codereview.appspot.com/11051/diff/1/2
File python/test/testtransitfeed.py (right):
http://codereview.appspot.com/11051/diff/1/2#newcode1262
Line 1262: "BADLOCATION,Airport Bad Location,36.868446,-116.784582,2,\n"
On 2008/12/15 20:48:44, Tom wrote:
> Shorter is better: give STATION a bad location_type and remove BADLOCATION,
> BULLFROG, STAGECOACH
I did this, but didn't remove BULLFROG and STAGECOACH as they are used by the
stop_times and trips that the class inherits and to remove them, would require
testing for more errors or re-doing the trips and stop_times for this test.
http://codereview.appspot.com/11051/diff/1/3
File python/transitfeed.py (right):
http://codereview.appspot.com/11051/diff/1/3#newcode3055
Line 3055: elif (stop.location_type not in [0,1] or
On 2008/12/15 20:48:44, Tom wrote:
> Instead of having a negative match and an extra branch how about making the
else
> on 3060
>
> elif stop.location_type in (0, 1) and other_stop.location_type in (0, 1):
>
> so that the conditions are consistent. location_type not in (0,1) will not
match
> any conditon and drop off the bottom.
>
> Stop._CheckAndSetAttr use a tuple (0, 1) instead of list for valid
> location_type. I don't think we want to factor out the list of valid types
> because we might want a valid type that isn't checked for proximity.
Done.
One nit pick and this is good to submit. http://codereview.appspot.com/11051/diff/1/2 File python/test/testtransitfeed.py (right): http://codereview.appspot.com/11051/diff/1/2#newcode1262 Line ...
15 years, 9 months ago
(2008-12-16 01:42:06 UTC)
#4
One nit pick and this is good to submit.
http://codereview.appspot.com/11051/diff/1/2
File python/test/testtransitfeed.py (right):
http://codereview.appspot.com/11051/diff/1/2#newcode1262
Line 1262: "BADLOCATION,Airport Bad Location,36.868446,-116.784582,2,\n"
On 2008/12/16 00:20:10, clancy.childs wrote:
> On 2008/12/15 20:48:44, Tom wrote:
> > Shorter is better: give STATION a bad location_type and remove BADLOCATION,
> > BULLFROG, STAGECOACH
>
> I did this, but didn't remove BULLFROG and STAGECOACH as they are used by the
> stop_times and trips that the class inherits and to remove them, would require
> testing for more errors or re-doing the trips and stop_times for this test.
Shucks. I didn't look at testBadLocationType closely and just saw that it had
less stop rows. A MemoryZipTestCase with less preinitialized objects would be
handy but doesn't need to be in this change.
http://codereview.appspot.com/11051/diff/203/9
File python/transitfeed.py (right):
http://codereview.appspot.com/11051/diff/203/9#newcode3060
Line 3060: elif stop.location_type in (0, 1) and other_stop.location_type in
(0, 1):
please wrap to 80 cols
Issue 11051: Fix runtime exception for unknown location_types at the same lat/lon
(Closed)
Created 15 years, 9 months ago by clancy.childs
Modified 15 years, 1 month ago
Reviewers: googletransitdatafeed_googlegroups.com, Tom
Base URL: http://googletransitdatafeed.googlecode.com/svn/trunk/
Comments: 6