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


Python CellAreaFactory.hashkey方法代碼示例

本文整理匯總了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)
開發者ID:SOFTowaha,項目名稱:ichnaea,代碼行數:9,代碼來源:test_area.py

示例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, [])
開發者ID:JaredKerim-Mozilla,項目名稱:ichnaea,代碼行數:12,代碼來源:test_area.py

示例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, [])
開發者ID:awoland,項目名稱:ichnaea,代碼行數:17,代碼來源:test_area.py

示例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)
開發者ID:therewillbecode,項目名稱:ichnaea,代碼行數:18,代碼來源:test_area.py

示例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)
開發者ID:therewillbecode,項目名稱:ichnaea,代碼行數:19,代碼來源:test_area.py


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