Skip to content

Commit

Permalink
Merge adad52f into 434fd5b
Browse files Browse the repository at this point in the history
  • Loading branch information
jclgoodwin committed Jul 28, 2017
2 parents 434fd5b + adad52f commit fcea9ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion multigtfs/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def date_convert(value): return datetime.strptime(value, '%Y%m%d')

def bool_convert(value): return (value == '1')

def char_convert(value): return (value.strip() or '')
def char_convert(value): return (value.strip(' "') or '')

def null_convert(value): return (value.strip() or None)

Expand Down
14 changes: 14 additions & 0 deletions multigtfs/tests/test_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ def test_import_trips_txt_multiple_services(self):
self.assertEqual(trip.service, service1)
self.assertFalse(service2.trip_set.exists())

def test_import_trips_txt_quoted_direction_id(self):
'''
A direction_id should be stripped of quotation marks
Issue 64
'''
trips_txt = StringIO("""\
route_id,service_id,trip_id,shape_id,trip_headsign,direction_id
R1,"S1","T3","46-860-y11-1.2.I","Aston Quay", "1"
""")
Trip.import_txt(trips_txt, self.feed)
trip = Trip.objects.get(trip_id='T3')
self.assertEqual(trip.direction, '1')

def test_export_trips_txt_empty(self):
trips_txt = Trip.export_txt(self.feed)
self.assertFalse(trips_txt)
Expand Down

0 comments on commit fcea9ac

Please sign in to comment.