本文整理汇总了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))
示例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)