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


Python CellAreaFactory.region方法代码示例

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


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

示例1: test_update

# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import region [as 别名]
    def test_update(self):
        area = CellAreaFactory(radio=Radio.gsm, num_cells=1)
        area.region = None
        CellAreaFactory(radio=Radio.gsm, region='DE', num_cells=1)
        CellAreaFactory(radio=Radio.gsm, region='DE', num_cells=2)
        CellAreaFactory(radio=Radio.gsm, region='CA', num_cells=2)
        CellAreaFactory(radio=Radio.wcdma, region='DE', num_cells=3)
        CellAreaFactory(radio=Radio.lte, region='CA', num_cells=4)
        WifiShardFactory.create_batch(5, region='DE')
        WifiShardFactory.create_batch(6, region='US')
        wifi = WifiShardFactory()
        wifi.region = None
        self.session.add(RegionStat(region='US', wifi=2))
        self.session.add(RegionStat(region='TW', wifi=1))
        self.session.flush()

        update_statregion.delay().get()
        stats = self.session.query(RegionStat).all()
        self.assertEqual(len(stats), 3)

        for stat in stats:
            values = (stat.gsm, stat.wcdma, stat.lte, stat.wifi)
            if stat.region == 'DE':
                self.assertEqual(values, (3, 3, 0, 5))
            elif stat.region == 'CA':
                self.assertEqual(values, (2, 0, 4, 0))
            elif stat.region == 'US':
                self.assertEqual(values, (0, 0, 0, 6))
开发者ID:cemoulto,项目名称:ichnaea,代码行数:30,代码来源:test_stats.py

示例2: test_update

# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import region [as 别名]
    def test_update(self, celery, session):
        area = CellAreaFactory(radio=Radio.gsm, num_cells=1)
        area.region = None
        BlueShardFactory.create_batch(2, region='CA')
        BlueShardFactory.create_batch(3, region='GB')
        CellAreaFactory(radio=Radio.gsm, region='DE', num_cells=1)
        CellAreaFactory(radio=Radio.gsm, region='DE', num_cells=2)
        CellAreaFactory(radio=Radio.gsm, region='CA', num_cells=2)
        CellAreaFactory(radio=Radio.wcdma, region='DE', num_cells=3)
        CellAreaFactory(radio=Radio.lte, region='CA', num_cells=4)
        WifiShardFactory.create_batch(5, region='DE')
        WifiShardFactory.create_batch(6, region='US')
        wifi = WifiShardFactory()
        wifi.region = None
        session.add(RegionStat(region='US', blue=1, wifi=2))
        session.add(RegionStat(region='TW', wifi=1))
        session.flush()

        update_statregion.delay().get()
        stats = session.query(RegionStat).all()
        assert len(stats) == 4

        for stat in stats:
            values = (stat.gsm, stat.wcdma, stat.lte, stat.blue, stat.wifi)
            if stat.region == 'DE':
                assert values == (3, 3, 0, 0, 5)
            elif stat.region == 'CA':
                assert values == (2, 0, 4, 2, 0)
            elif stat.region == 'GB':
                assert values == (0, 0, 0, 3, 0)
            elif stat.region == 'US':
                assert values == (0, 0, 0, 0, 6)
开发者ID:crankycoder,项目名称:ichnaea,代码行数:34,代码来源:test_stats.py


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