本文整理汇总了Python中ichnaea.tests.factories.CellAreaFactory.hashkey方法的典型用法代码示例。如果您正苦于以下问题:Python CellAreaFactory.hashkey方法的具体用法?Python CellAreaFactory.hashkey怎么用?Python CellAreaFactory.hashkey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ichnaea.tests.factories.CellAreaFactory
的用法示例。
在下文中一共展示了CellAreaFactory.hashkey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_remove
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import hashkey [as 别名]
def test_remove(self):
area = CellAreaFactory()
self.session.flush()
self.area_queue.enqueue([area.hashkey()])
self.assertEqual(scan_areas.delay().get(), 1)
self.assertEqual(self.session.query(CellArea).count(), 0)
示例2: test_scan_areas_remove
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import hashkey [as 别名]
def test_scan_areas_remove(self):
# create an orphaned lac entry
area = CellAreaFactory()
self.session.flush()
self.area_queue.enqueue([area.hashkey()])
# after scanning the orphaned record gets removed
self.assertEqual(scan_areas.delay().get(), 1)
areas = self.session.query(CellArea).all()
self.assertEqual(areas, [])
示例3: test_scan_areas_remove
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import hashkey [as 别名]
def test_scan_areas_remove(self):
session = self.session
redis_client = self.redis_client
# create an orphaned lac entry
area = CellAreaFactory()
session.flush()
redis_key = self.celery_app.data_queues['cell_area_update']
enqueue_areas(session, redis_client,
[area.hashkey()], redis_key)
# after scanning the orphaned record gets removed
self.assertEqual(scan_areas.delay().get(), 1)
areas = session.query(CellArea).all()
self.assertEqual(areas, [])
示例4: test_update
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import hashkey [as 别名]
def test_update(self):
area = CellAreaFactory(num_cells=2, range=500, avg_cell_range=100)
area_key = area.hashkey()
cell = CellFactory(
lat=area.lat, lon=area.lon, range=200, **area_key.__dict__)
self.session.commit()
self.area_queue.enqueue([area_key])
self.assertEqual(scan_areas.delay().get(), 1)
area = self.session.query(CellArea).one()
self.assertAlmostEqual(area.lat, cell.lat)
self.assertAlmostEqual(area.lon, cell.lon)
self.assertEqual(area.range, 0)
self.assertEqual(area.num_cells, 1)
self.assertEqual(area.avg_cell_range, 200)
示例5: test_update_incomplete_cell
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import hashkey [as 别名]
def test_update_incomplete_cell(self):
area = CellAreaFactory(range=500)
area_key = area.hashkey()
cell = CellFactory(
lat=area.lat + 0.0002, lon=area.lon, **area_key.__dict__)
CellFactory(lat=None, lon=None, **area_key.__dict__)
CellFactory(lat=area.lat, lon=area.lon,
max_lat=None, min_lon=None, **area_key.__dict__)
self.session.commit()
self.area_queue.enqueue([area_key])
self.assertEqual(scan_areas.delay().get(), 1)
area = self.session.query(CellArea).one()
self.assertAlmostEqual(area.lat, cell.lat - 0.0001)
self.assertAlmostEqual(area.lon, cell.lon)
self.assertEqual(area.num_cells, 2)