本文整理汇总了Python中ichnaea.tests.factories.CellAreaFactory.score方法的典型用法代码示例。如果您正苦于以下问题:Python CellAreaFactory.score方法的具体用法?Python CellAreaFactory.score怎么用?Python CellAreaFactory.score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ichnaea.tests.factories.CellAreaFactory
的用法示例。
在下文中一共展示了CellAreaFactory.score方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_smallest_area
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import score [as 别名]
def test_smallest_area(self):
now = util.utcnow()
area = CellAreaFactory(radius=25000, num_cells=8)
area2 = CellAreaFactory(radius=30000, lat=area.lat + 0.2, num_cells=6)
self.session.flush()
query = self.model_query(cells=[area, area2])
results = self.source.search(query)
self.check_model_results(results, [area])
self.assertAlmostEqual(results.best().score, area.score(now), 4)
示例2: test_multiple_mcc
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import score [as 别名]
def test_multiple_mcc(self):
now = util.utcnow()
region = GEOCODER.regions_for_mcc(235, metadata=True)[0]
cell = CellAreaFactory(mcc=234, num_cells=6)
cell2 = CellAreaFactory(mcc=235, num_cells=8)
self.session.flush()
query = self.model_query(cells=[cell, cell2])
results = self.source.search(query)
self.assertTrue(len(results) > 2)
best_result = results.best(query.expected_accuracy)
self.assertEqual(best_result.region_code, region.code)
self.assertAlmostEqual(best_result.score, 1.25 + cell.score(now), 4)
示例3: test_smallest_area
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import score [as 别名]
def test_smallest_area(self, geoip_db, http_session,
session, source, stats):
now = util.utcnow()
area = CellAreaFactory(radius=25000, num_cells=8)
area2 = CellAreaFactory(radius=30000, lat=area.lat + 0.2, num_cells=6)
session.flush()
query = self.model_query(
geoip_db, http_session, session, stats,
cells=[area, area2])
results = source.search(query)
self.check_model_results(results, [area])
assert results.best().score == area.score(now)
示例4: test_ambiguous_mcc
# 需要导入模块: from ichnaea.tests.factories import CellAreaFactory [as 别名]
# 或者: from ichnaea.tests.factories.CellAreaFactory import score [as 别名]
def test_ambiguous_mcc(self):
now = util.utcnow()
regions = GEOCODER.regions_for_mcc(234, metadata=True)
cell = CellAreaFactory(mcc=234, num_cells=10)
self.session.flush()
query = self.model_query(cells=[cell])
results = self.source.search(query)
self.check_model_results(results, regions)
self.assertEqual(results.best().region_code, 'GB')
for result in results:
score = 0.25
if result.region_code == 'GB':
score += cell.score(now)
self.assertAlmostEqual(result.score, score, 4)
self.check_stats(counter=[
(self.api_type + '.source',
['key:test', 'region:none', 'source:internal',
'accuracy:low', 'status:hit']),
])