本文整理汇总了Python中ichnaea.tests.factories.BlueShardFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python BlueShardFactory.create_batch方法的具体用法?Python BlueShardFactory.create_batch怎么用?Python BlueShardFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ichnaea.tests.factories.BlueShardFactory
的用法示例。
在下文中一共展示了BlueShardFactory.create_batch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update
# 需要导入模块: from ichnaea.tests.factories import BlueShardFactory [as 别名]
# 或者: from ichnaea.tests.factories.BlueShardFactory import create_batch [as 别名]
def test_update(self):
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
self.session.add(RegionStat(region='US', blue=1, 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), 4)
for stat in stats:
values = (stat.gsm, stat.wcdma, stat.lte, stat.blue, stat.wifi)
if stat.region == 'DE':
self.assertEqual(values, (3, 3, 0, 0, 5))
elif stat.region == 'CA':
self.assertEqual(values, (2, 0, 4, 2, 0))
elif stat.region == 'GB':
self.assertEqual(values, (0, 0, 0, 3, 0))
elif stat.region == 'US':
self.assertEqual(values, (0, 0, 0, 0, 6))