本文整理汇总了Python中ichnaea.tests.factories.BlueShardFactory.score方法的典型用法代码示例。如果您正苦于以下问题:Python BlueShardFactory.score方法的具体用法?Python BlueShardFactory.score怎么用?Python BlueShardFactory.score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ichnaea.tests.factories.BlueShardFactory
的用法示例。
在下文中一共展示了BlueShardFactory.score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_blue
# 需要导入模块: from ichnaea.tests.factories import BlueShardFactory [as 别名]
# 或者: from ichnaea.tests.factories.BlueShardFactory import score [as 别名]
def test_blue(self):
now = util.utcnow()
region = GEOCODER.regions_for_mcc(235, metadata=True)[0]
blue1 = BlueShardFactory(samples=10)
blue2 = BlueShardFactory(samples=20)
blue3 = BlueShardFactory.build(region='DE', samples=100)
self.session.flush()
query = self.model_query(blues=[blue1, blue2, blue3])
results = self.source.search(query)
self.check_model_results(results, [region])
best_result = results.best()
self.assertEqual(best_result.region_code, region.code)
self.assertAlmostEqual(
best_result.score, blue1.score(now) + blue2.score(now), 4)
self.check_stats(counter=[
(self.api_type + '.source',
['key:test', 'region:none', 'source:internal',
'accuracy:low', 'status:hit']),
])