当前位置: 首页>>代码示例>>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;未经允许,请勿转载。