本文整理汇总了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)