本文整理匯總了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)