本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.call_get_preset方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.call_get_preset方法的具体用法?Python Dependency.call_get_preset怎么用?Python Dependency.call_get_preset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.call_get_preset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_retail_get_whitespace_stores
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import call_get_preset [as 别名]
def test_retail_get_whitespace_stores(self):
main_access = Dependency("CoreAPIProvider").value
company_id = insert_test_company()
trade_area_1 = insert_test_geoprocessed_trade_area(home_store_id=1, away_store_id=21, company_id=company_id,
company_name="woot", opened_date=None, closed_date=None,
longitude=35, latitude=-40)
trade_area_2 = insert_test_geoprocessed_trade_area(home_store_id=2, away_store_id=22, company_id=company_id,
company_name="woot", opened_date=None, closed_date=None,
longitude=36, latitude=-41)
trade_area_3 = insert_test_geoprocessed_trade_area(home_store_id=3, away_store_id=23, company_id=999,
company_name="woot", opened_date=None, closed_date=None,
longitude=37, latitude=-42)
params = {
"bannerIds": [company_id]
}
context = {}
resource = "/data/preset/whitespace/stores"
data = main_access.call_get_preset(resource, params=params, context=context)
stores = data["stores"]
self.test_case.assertEqual(len(stores), 2)
self.test_case.assertItemsEqual(stores[0][-6], [35, -40])
self.test_case.assertItemsEqual(stores[1][-6], [36, -41])
示例2: test_retail_get_whitespace_grid
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import call_get_preset [as 别名]
def test_retail_get_whitespace_grid(self):
main_access = Dependency("CoreAPIProvider").value
grid_name = "Grid 100 mile x 100 mile"
threshold = "GridDistanceMiles100"
grid_id = insert_test_white_space_grid(threshold, grid_name)
another_grid_name = "Random Grid 7 mile x 7 mile"
another_threshold = "GridDistanceMiles7"
another_grid_id = insert_test_white_space_grid(threshold, another_grid_name)
grid_cell_1_poly = [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]
grid_cell_2_poly = [[[1, 0], [1, 1], [2, 1], [2, 0], [1, 0]]]
grid_cell_3_poly = [[[0, 1], [0, 2], [1, 2], [1, 1], [0, 1]]]
grid_cell_4_poly = [[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]]
grid_cell_1_id = insert_test_white_space_grid_cell(grid_id, grid_cell_1_poly, threshold, grid_name, 0.5, 0.5)
grid_cell_2_id = insert_test_white_space_grid_cell(grid_id, grid_cell_2_poly, threshold, grid_name, 1.5, 0.5)
grid_cell_3_id = insert_test_white_space_grid_cell(grid_id, grid_cell_3_poly, threshold, grid_name, 0.5, 1.5)
grid_cell_4_id = insert_test_white_space_grid_cell(another_grid_id, grid_cell_4_poly, another_threshold,
another_grid_name, 1.5, 1.5)
context = {}
params = {}
resource = "/data/preset/whitespace/grid/%s" % threshold
data = main_access.call_get_preset(resource, params=params, context=context)
grid_cells = data["grid_cells"]
grid_cells_dict = {}
for grid_cell in grid_cells:
grid_cells_dict[grid_cell[0]] = grid_cell[1]
self.test_case.assertEqual(len(grid_cells), 3)
self.test_case.assertItemsEqual(grid_cells_dict[grid_cell_1_id], grid_cell_1_poly)
self.test_case.assertItemsEqual(grid_cells_dict[grid_cell_2_id], grid_cell_2_poly)
self.test_case.assertItemsEqual(grid_cells_dict[grid_cell_3_id], grid_cell_3_poly)
is_grid_cell_4_returned = grid_cell_4_id in grid_cells_dict.keys()
self.test_case.assertEqual(is_grid_cell_4_returned, False)