本文整理汇总了Python中geoprocessing.business_logic.business_objects.store.Store._assumed_closed_date方法的典型用法代码示例。如果您正苦于以下问题:Python Store._assumed_closed_date方法的具体用法?Python Store._assumed_closed_date怎么用?Python Store._assumed_closed_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geoprocessing.business_logic.business_objects.store.Store
的用法示例。
在下文中一共展示了Store._assumed_closed_date方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _assumed_closed_date [as 别名]
def test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores(self):
"""
This verifies that it is inserted if stores' open/closed dates are still open but competitive_companies start after
"""
# create a mock home store
home_store = Store()
home_store.store_id = 1
home_store.company_id = 1
home_store._assumed_opened_date = "1900-01-01"
home_store._opened_date = "1900-01-01"
home_store._assumed_closed_date = None
home_store._closed_date = None
# create three mock stores
new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "1900-01-01", None, "1900-01-01", None, "2011-01-01", None)
# create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
away_stores = [new_competitor]
competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)
# call synchronize and verify that the right store was inserted with the right dates
competitive_stores.synchronize_competitive_stores_in_db()
self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [
competitive_stores._create_batch_competition_structure(new_competitor, datetime(2011, 1, 1), None, True, home_store.store_id)
])
self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
示例2: test_synchronize_competitive_stores__stores_overlap_in_dates__home_store_dates_within_away_store
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _assumed_closed_date [as 别名]
def test_synchronize_competitive_stores__stores_overlap_in_dates__home_store_dates_within_away_store(self):
"""
This verifies that it is inserted if stores' open/closed dates do overlap with home store contained between the away store dates
"""
# create a mock home store
home_store = Store()
home_store.store_id = 1
home_store.company_id = 1
home_store._assumed_opened_date = "2011-01-01"
home_store._opened_date = "2011-01-01"
home_store._assumed_closed_date = "2011-12-01"
home_store._closed_date = "2011-12-01"
# create three mock stores
new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "2010-01-01", "2012-12-01", "2010-01-01", "2012-12-01", None, None)
# create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
away_stores = [new_competitor]
competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)
# call synchronize and verify that the right store was inserted with the right dates
competitive_stores.synchronize_competitive_stores_in_db()
self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [
competitive_stores._create_batch_competition_structure(new_competitor, datetime(2011, 01, 01), datetime(2011, 12, 01), True, home_store.store_id)
])
self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
示例3: Store
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _assumed_closed_date [as 别名]
def test_synchronize_competitive_stores__competitive_company_instance_opens_after_competitive_stores_close(self):
"""
This verifies that NOTHING is inserted if stores' close before companies become competitive
"""
# create a mock home store
home_store = Store()
home_store.store_id = 1
home_store.company_id = 1
home_store._assumed_opened_date = "2009-01-01"
home_store._opened_date = "2009-01-01"
home_store._assumed_closed_date = "2010-12-01"
home_store._closed_date = "2010-12-01"
# create three mock stores
new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "2009-01-01", "2010-12-01", "2009-01-01", "2010-12-01", "2011-01-01", "2011-12-01")
# create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
away_stores = [new_competitor]
competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)
# call synchronize and verify that the right store was inserted with the right dates
competitive_stores.synchronize_competitive_stores_in_db()
self.assertEqual(len(self._data_repository.upserted_away_stores), 0)
self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [])
self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)
示例4: test_synchronize_competitive_stores__upsert__home_closes_before_away_opens
# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import _assumed_closed_date [as 别名]
def test_synchronize_competitive_stores__upsert__home_closes_before_away_opens(self):
"""
This verifies that nothing is inserted if stores' open/closed dates do not overlap
"""
# create a mock home store
home_store = Store()
home_store.store_id = 1
home_store.company_id = 1
home_store._assumed_closed_date = "2011-01-01"
home_store._closed_date = "2011-01-01"
# create three mock stores
new_competitor = StoreCompetitionInstance.standard_init(4, 4, -1, -1, None, None, "2012-01-01", None, "2012-01-01", None, None, None)
# create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
away_stores = [new_competitor]
competitive_stores = CompetitiveStoreHelper(home_store, away_stores, 10, self._data_repository)
# call synchronize and verify that the right store was inserted
competitive_stores.synchronize_competitive_stores_in_db()
self.assertEqual(len(self._data_repository.upserted_away_stores), 0)
self.assertEqual(self._data_repository.batch_upserted_competitive_stores, [])
self.assertEqual(self._data_repository.batch_upserted_trade_area_id, 10)