当前位置: 首页>>代码示例>>Python>>正文


Python DatabaseHandler.get_address_generator方法代码示例

本文整理汇总了Python中DatabaseHandler.DatabaseHandler.get_address_generator方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseHandler.get_address_generator方法的具体用法?Python DatabaseHandler.get_address_generator怎么用?Python DatabaseHandler.get_address_generator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseHandler.DatabaseHandler的用法示例。


在下文中一共展示了DatabaseHandler.get_address_generator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_address_without_route_returns_with_correct_id

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_returns_with_correct_id(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     handler.add_address(MapLocation(latitude=2, longitude=2, id=222))
     address_generator = handler.get_address_generator()
     self.assertEqual(MapLocation(latitude=2, longitude=2, id=222),
                      address_generator.next(),
                      "MapLocation should return correct id")
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:9,代码来源:test_DatabaseHandler.py

示例2: test_get_address_without_route_returns_address_when_routes_empty

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_returns_address_when_routes_empty(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     handler.add_address(location=MapLocation(latitude=5, longitude=6, id=1))
     address_generator = handler.get_address_generator()
     self.assertEqual(MapLocation(latitude=5, longitude=6, id=1),
                      address_generator.next(),
                      "Only MapLocation in addresses was not returned")
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:9,代码来源:test_DatabaseHandler.py

示例3: test_get_address_without_route_generator_new_address_second_time

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_generator_new_address_second_time(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     handler.add_address(location=MapLocation(latitude=1, longitude=1))
     handler.add_address(location=MapLocation(latitude=2, longitude=2))
     address_generator = handler.get_address_generator()
     self.assertEqual(MapLocation(latitude=1, longitude=1, id=1),
                      address_generator.next(),
                      "first returned MapLocation was not correct")
     self.assertEqual(MapLocation(latitude=2, longitude=2, id=2),
                      address_generator.next(),
                      "second returned MapLocation was not correct")
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:13,代码来源:test_DatabaseHandler.py

示例4: test_get_address_without_route_returns_address_without_route

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_returns_address_without_route(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     handler.add_address(location=MapLocation(latitude=1, longitude=2))
     handler.add_address(location=MapLocation(latitude=3, longitude=4))
     handler.add_stop(location=MapLocation(latitude=0, longitude=0))
     c = handler.conn.cursor()
     c.execute("INSERT INTO routes (address_id, stop_id, distance, time)"
               "VALUES (1, 1, 1, 1)")
     c.close()
     address_generator = handler.get_address_generator()
     self.assertEqual(MapLocation(latitude=3, longitude=4, id=2),
                      address_generator.next(),
                      "the MapLocation without route was not returned")
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:15,代码来源:test_DatabaseHandler.py

示例5: test_get_address_without_route_generator_yield_MapLocations

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_generator_yield_MapLocations(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     handler.add_address(location=MapLocation(latitude=1, longitude=1))
     address_generator = handler.get_address_generator()
     self.assertIsInstance(address_generator.next(), MapLocation)
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:7,代码来源:test_DatabaseHandler.py

示例6: test_get_address_without_route_generator_returns_generator

# 需要导入模块: from DatabaseHandler import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler.DatabaseHandler import get_address_generator [as 别名]
 def test_get_address_without_route_generator_returns_generator(self):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     self.assertIsInstance(handler.get_address_generator(),
                           types.GeneratorType)
开发者ID:hansyuechen,项目名称:RTAHeatMap,代码行数:6,代码来源:test_DatabaseHandler.py


注:本文中的DatabaseHandler.DatabaseHandler.get_address_generator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。