當前位置: 首頁>>代碼示例>>Python>>正文


Python Stop.export_txt方法代碼示例

本文整理匯總了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
""")
開發者ID:derickl,項目名稱:gtfs-server,代碼行數:12,代碼來源:stop.py

示例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
""")
開發者ID:derickl,項目名稱:gtfs-server,代碼行數:14,代碼來源:stop.py

示例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
""")
開發者ID:derickl,項目名稱:gtfs-server,代碼行數:15,代碼來源:stop.py

示例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)
開發者ID:derickl,項目名稱:gtfs-server,代碼行數:5,代碼來源:stop.py


注:本文中的multigtfs.models.Stop.export_txt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。