本文整理匯總了Python中multigtfs.models.Stop.export_txt方法的典型用法代碼示例。如果您正苦於以下問題:Python Stop.export_txt方法的具體用法?Python Stop.export_txt怎麽用?Python Stop.export_txt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類multigtfs.models.Stop
的用法示例。
在下文中一共展示了Stop.export_txt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_export_stops_txt_minimal
# 需要導入模塊: from multigtfs.models import Stop [as 別名]
# 或者: from multigtfs.models.Stop import export_txt [as 別名]
def test_export_stops_txt_minimal(self):
Stop.objects.create(
feed=self.feed, stop_id='FUR_CREEK_RES',
name='Furnace Creek Resort (Demo)',
point="POINT(-117.133162 36.425288)")
stops_txt = Stop.export_txt(self.feed)
self.assertEqual(stops_txt, """\
stop_id,stop_name,stop_lat,stop_lon
FUR_CREEK_RES,Furnace Creek Resort (Demo),36.425288,-117.133162
""")
示例2: test_export_stops_utf8
# 需要導入模塊: from multigtfs.models import Stop [as 別名]
# 或者: from multigtfs.models.Stop import export_txt [as 別名]
def test_export_stops_utf8(self):
Stop.objects.create(
feed=self.feed, stop_id=6071,
name=b'The Delta Caf\x82'.decode('latin1'),
point='POINT(-95.975834 36.114554)')
stops_txt = Stop.export_txt(self.feed)
if isinstance(stops_txt, text_type): # pragma: no cover
stops_txt = stops_txt.encode('utf-8')
self.assertEqual(stops_txt, b"""\
stop_id,stop_name,stop_lat,stop_lon
6071,The Delta Caf\xc2\x82,36.114554,-95.975834
""")
示例3: test_export_stops_extra_data
# 需要導入模塊: from multigtfs.models import Stop [as 別名]
# 或者: from multigtfs.models.Stop import export_txt [as 別名]
def test_export_stops_extra_data(self):
self.feed.meta = {'extra_columns': {'Stop': ['extra']}}
self.feed.save()
Stop.objects.create(
feed=self.feed, stop_id='FUR_CREEK_RES',
name='Furnace Creek Resort (Demo)',
point="POINT(-117.133162 36.425288)",
extra_data={'extra': '7'})
stops_txt = Stop.export_txt(self.feed)
self.assertEqual(stops_txt, """\
stop_id,stop_name,stop_lat,stop_lon,extra
FUR_CREEK_RES,Furnace Creek Resort (Demo),36.425288,-117.133162,7
""")
示例4: test_export_stops_txt_none
# 需要導入模塊: from multigtfs.models import Stop [as 別名]
# 或者: from multigtfs.models.Stop import export_txt [as 別名]
def test_export_stops_txt_none(self):
stops_txt = Stop.export_txt(self.feed)
self.assertFalse(stops_txt)