本文整理汇总了Python中geoprocessing.business_logic.business_objects.store.Store.simple_init_with_address方法的典型用法代码示例。如果您正苦于以下问题:Python Store.simple_init_with_address方法的具体用法?Python Store.simple_init_with_address怎么用?Python Store.simple_init_with_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geoprocessing.business_logic.business_objects.store.Store
的用法示例。
在下文中一共展示了Store.simple_init_with_address方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_single_player_to_foreign_competitor_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_single_player_to_foreign_competitor_transition(self):
trade_area_id = 10
home_store = Store.simple_init_with_address(1, 1, -1, -1)
# has foreign company
new_away_stores = [
Store.standard_init(2, 1, -1, 1, None, None, None, "2012-01-20", None, None, None),
Store.standard_init(3, 1, -1, 1, None, None, None, "2012-01-30", None, None, None),
Store.standard_init(4, 1, -1, 1, None, None, None, "2012-01-01", None, None, None),
Store.standard_init(5, 2, -1, 1, None, None, None, "2012-01-05", None, None, None)
]
# same company
previous_away_stores = [
Store.simple_init_with_address(2, 1, -1, 1),
Store.simple_init_with_address(3, 1, -1, 1),
Store.simple_init_with_address(4, 1, -1, 1),
]
# sync monopolies and verify that a new one is inserted and non are closed
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
# one closed and none opened
self.assertEqual(len(self._data_repository.closed_monopolies), 1)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 1)
self.assertEqual(len(self._data_repository.upserted_monopolies), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 0)
# verify end_date = earliest start_date from new stores THAT ARE FOREIGN COMPETITORS
self.assertEqual(self._data_repository.closed_monopolies_dates[0], datetime(2012, 01, 05))
示例2: test_single_player_to_single_player_monopoly_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_single_player_to_single_player_monopoly_transition(self):
trade_area_id = 10
home_store = Store.simple_init_with_address(1, 1, -1, -1)
# same company
new_away_stores = [Store.simple_init_with_address(2, 1, -1, 1)]
# same company
previous_away_stores = [Store.simple_init_with_address(2, 1, -1, 1)]
# sync monopolies and verify that a new one is inserted and non are closed
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
self.assertEqual(len(self._data_repository.closed_monopolies), 0)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 0)
示例3: test_absolute_monopoly_to_single_player_monopoly_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_absolute_monopoly_to_single_player_monopoly_transition(self):
trade_area_id = 10
home_store = Store.simple_init_with_address(1, 1, -1, -1)
# same company
new_away_stores = [
Store.standard_init(2, 1, -1, 1, None, None, None, "2012-01-20", None, None, None),
Store.standard_init(3, 1, -1, 1, None, None, None, "2012-01-01", None, None, None),
Store.standard_init(4, 1, -1, 1, None, None, None, "2012-01-30", None, None, None)
]
previous_away_stores = []
# mock up active monopoly in the database to signal that this is not a new store
self._data_repository.active_monopolies_stores[1] = Monopoly(1, CompetitionType.AbsoluteMonopoly, trade_area_id, None, None)
# sync monopolies and verify that a new one is inserted and non are closed
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
# one closed and one opened
self.assertEqual(len(self._data_repository.closed_monopolies), 1)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 1)
self.assertEqual(len(self._data_repository.upserted_monopolies), 1)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 1)
# new upserted is correct type
self.assertEqual(self._data_repository.upserted_monopolies[0], 1)
self.assertEqual(self._data_repository.upserted_monopolies_types[0], CompetitionType.SinglePlayerMonopoly)
self.assertEqual(self._data_repository.upserted_monopolies_trade_areas[0], trade_area_id)
# verify start_date and end_date = earliest close_date from previous stores
self.assertEqual(self._data_repository.closed_monopolies_dates[0], datetime(2012, 01, 01))
self.assertEqual(self._data_repository.upserted_monopolies_dates[0], datetime(2012, 01, 01))
示例4: setUp
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def setUp(self):
# set up mock dependencies
register_mock_dependencies()
self.data_provider = Dependency("DataRepository").value
self.rest_provider = Dependency("RestProvider").value
self.ba_online_helper = Dependency("BAOnlineConnection").value
self.config = Dependency("Config").value
# set up data
self.store = Store.simple_init_with_address(store_id=777777, company_id=666666, longitude=99.99999999, latitude=88.88888888)
self.store.address_id = 10
self.data_provider.stores[self.store.store_id] = self.store
self.data_provider.addresses[10] = self.store.address
#mock trade area
trade_area_id = 99
trade_area = TradeArea.standard_init(trade_area_id, self.store.store_id, None, None,
TradeAreaThreshold.DriveTimeMinutes10)
self.data_provider.mock_trade_areas[(self.store.store_id, TradeAreaThreshold.DriveTimeMinutes10)] = trade_area
#mock trade area shape
self.data_provider.trade_area_shapes[trade_area_id] = 'LINESTRING(1 1, 1 2, 2 2, 2 1, 1 1)'
self.expected_trade_area_json = '{"RecordSet": {"geometryType": "esriGeometryPolygon", "features": [{"geometry": {"rings": [[[1.0, 1.0], [1.0, 2.0], [2.0, 2.0], [2.0, 1.0], [1.0, 1.0]]], "spatialReference": {"wkid": 4326}}, "attributes": {"area_id": 99, "store_id": 777777}}], "spatialReference": {"wkid": 4326}}}'
# make sure config is correct with the below reports
self.config.ba_online_templates = ["acs_housing", "traffic"]
示例5: test_select_competitive_stores_within_range
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_select_competitive_stores_within_range(self):
store = Store.simple_init_with_address(43, 24, longitude = 1, latitude = -1)
competitor_stores = store.select_stores_of_competitive_companies_within_range()
# verify that we're using the real lat/long
self.assertEqual(self._data_repository.latitude_range.start, SignalDecimal(-1.4))
self.assertEqual(self._data_repository.latitude_range.stop, SignalDecimal(-0.6))
self.assertEqual(len(self._data_repository.longitude_range), 1)
self.assertEqual(self._data_repository.longitude_range[0].start, SignalDecimal(0.6))
self.assertEqual(self._data_repository.longitude_range[0].stop, SignalDecimal(1.4))
示例6: setUp
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def setUp(self):
# set up mock dependencies
register_mock_dependencies()
self._rest_provider = MockRestProvider()
self._sql_provider = MockSQLDataRepository()
# set up test store
self._store = Store.simple_init_with_address(42, 14107, -100.00, 45.00)
self._sql_provider.stores[self._store.store_id] = self._store
self._store.address_id = 10
self._sql_provider.addresses[10] = self._store.address
self._threshold = TradeAreaThreshold.LatitudeLongitudeDecimal
示例7: test_select_stores_of_competitive_companies_within_old_problem_range
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_select_stores_of_competitive_companies_within_old_problem_range(self):
store = Store.simple_init_with_address(43, 24, longitude = 1, latitude = 1)
store.problem_latitude = 50
store.problem_longitude = -50
competitor_stores = store.select_stores_of_competitive_companies_within_old_problem_range()
# verify that we're using the problem lat/long
self.assertEqual(self._data_repository.latitude_range.start, SignalDecimal(49.6))
self.assertEqual(self._data_repository.latitude_range.stop, SignalDecimal(50.4))
self.assertEqual(len(self._data_repository.longitude_range), 1)
self.assertEqual(self._data_repository.longitude_range[0].start, SignalDecimal(-50.4))
self.assertEqual(self._data_repository.longitude_range[0].stop, SignalDecimal(-49.6))
示例8: test_new_store_to_foreign_competitor_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_new_store_to_foreign_competitor_transition(self):
trade_area_id = 10
home_store = Store.standard_init(1, 1, -1, -1, None, None, None, "2012-01-01", None, None, None)
# competitor from different company
new_away_stores = [Store.simple_init_with_address(2, 2, -1, 1)]
previous_away_stores = []
# sync monopolies and verify that nothing happens
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
self.assertEqual(len(self._data_repository.closed_monopolies), 0)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 0)
示例9: test_select_zips_within_range
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_select_zips_within_range(self):
#set up a test store with a specific zip code and lat/long
store = Store.simple_init_with_address(44, 24, longitude = 10.24, latitude = 10.24)
store.address.zip_code = "12345"
centroid = GeographicalCoordinate(store.address.longitude, store.address.latitude)
# the mock data repo makes a single-item list of zip codes
# using the store's own zip code and lat/long
expected_zips = [ZipCode.standard_init(store.address.zip_code, centroid)]
self._data_repository.zips = expected_zips
test_zips = store.select_zips_within_range()
self.assertEqual(test_zips, expected_zips)
示例10: test_foreign_competitor_to_single_player_monopoly_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_foreign_competitor_to_single_player_monopoly_transition(self):
trade_area_id = 10
home_store = Store.simple_init_with_address(1, 1, -1, -1)
# same company
new_away_stores = [Store.simple_init_with_address(2, 1, -1, 1)]
# different company (i.e. foreign competitors)
previous_away_stores = [
Store.standard_init(3, 2, -1, 1, None, None, None, None, "2012-01-20", None, None),
Store.standard_init(4, 2, -1, 1, None, None, None, None, "2012-01-01", None, None),
Store.standard_init(5, 1, -1, 1, None, None, None, None, "2012-01-30", None, None)
]
# sync monopolies and verify that a new one is inserted and none are closed
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
self.assertEqual(len(self._data_repository.closed_monopolies), 0)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies), 1)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 1)
self.assertEqual(self._data_repository.upserted_monopolies[0], 1)
self.assertEqual(self._data_repository.upserted_monopolies_types[0], CompetitionType.SinglePlayerMonopoly)
self.assertEqual(self._data_repository.upserted_monopolies_trade_areas[0], trade_area_id)
# verify date matches the largest of the previous foreign away store.
# this is a key check because there's another company who's not a foreign competitor with a later date!!!!!!!
self.assertEqual(self._data_repository.upserted_monopolies_dates[0], datetime(2012, 01, 20))
示例11: test_absolute_monopoly_to_absolute_monopoly_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_absolute_monopoly_to_absolute_monopoly_transition(self):
trade_area_id = 10
home_store = Store.simple_init_with_address(1, 1, -1, -1)
new_away_stores = []
previous_away_stores = []
# mock up active monopoly in the database to signal that this is not a new store
self._data_repository.active_monopolies_stores[1] = Monopoly(1, CompetitionType.AbsoluteMonopoly, trade_area_id, None, None)
# sync monopolies and verify that nothing happens
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
self.assertEqual(len(self._data_repository.closed_monopolies), 0)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 0)
示例12: setUp
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def setUp(self):
# set up mock dependencies
register_mock_dependencies()
self.rest_provider = Dependency("RestProvider").value
self.sql_provider = Dependency("DataRepository").value
# Joseph A Bank
self.store = Store.simple_init_with_address(43, 14107, -100.00, 45.00)
self.sql_provider.stores[self.store.store_id] = self.store
self.store.address_id = 10
self.sql_provider.addresses[10] = self.store.address
self.away_stores = {
44: StoreCompetitionInstance.basic_init_with_competition(44, 14106, -73.54, 41.10, 1347901),
45: StoreCompetitionInstance.basic_init_with_competition(45, 14107, -80.40, 37.21, 1347884)}
示例13: setUpClass
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def setUpClass(cls):
# register dependencies and get local copies
register_concrete_dependencies(False)
cls._config = Dependency("Config").value
cls._ba_online_conn = Dependency("BAOnlineConnection").value
# create sample store (home_store) and competitor stores
cls._store = Store.simple_init_with_address(000042, 14107, -72.3950, 40.8850)
cls._home_store = cls._store
cls._away_stores = {
000043: StoreCompetitionInstance.basic_init(000043, 14106, -73.9735, 40.7697),
000044: StoreCompetitionInstance.basic_init(000044, 14106, -73.4261, 40.8681)
}
# make config match the below expectations
cls._config.gp1_templates = ["Demographic and Income Profile", "Nexus Age by Sex Report", "Automotive Aftermarket Expenditures"]
cls._config.ba_online_templates = ["acs_housing", "traffic"]
示例14: setUp
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def setUp(self):
# set up mock dependencies
register_mock_dependencies()
self.data_provider = Dependency("DataRepository").value
self.rest_provider = Dependency("RestProvider").value
self.ba_online_helper = Dependency("BAOnlineConnection").value
self.config = Dependency("Config").value
# set up data
self.store = Store.simple_init_with_address(store_id=777777, company_id=666666, longitude=99.99999999, latitude=88.88888888)
self.store.address_id = 10
self.data_provider.stores[self.store.store_id] = self.store
self.data_provider.addresses[10] = self.store.address
# make sure config is correct with the below reports
self.config.ba_online_templates = ["acs_housing", "traffic"]
示例15: test_new_store_to_single_player_monopoly_transition
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import simple_init_with_address [as 别名]
def test_new_store_to_single_player_monopoly_transition(self):
trade_area_id = 10
home_store = Store.standard_init(1, 1, -1, -1, None, None, None, "2012-01-01", None, None, None)
# competitor from same company
new_away_stores = [Store.simple_init_with_address(2, 1, -1, 1)]
previous_away_stores = []
# sync monopolies and verify that a new one is inserted and none are closed
MonopolyTransitionHelper.transition_monopoly_record(home_store, trade_area_id, new_away_stores, previous_away_stores, self._data_repository, [])
self.assertEqual(len(self._data_repository.closed_monopolies), 0)
self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)
self.assertEqual(len(self._data_repository.upserted_monopolies), 1)
self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 1)
self.assertEqual(self._data_repository.upserted_monopolies[0], 1)
self.assertEqual(self._data_repository.upserted_monopolies_types[0], CompetitionType.SinglePlayerMonopoly)
self.assertEqual(self._data_repository.upserted_monopolies_trade_areas[0], trade_area_id)
# verify date matches the home store opening date
self.assertEqual(self._data_repository.upserted_monopolies_dates[0], datetime(2012, 01, 01))