当前位置: 首页>>代码示例>>Python>>正文


Python Store.standard_init方法代码示例

本文整理汇总了Python中geoprocessing.business_logic.business_objects.store.Store.standard_init方法的典型用法代码示例。如果您正苦于以下问题:Python Store.standard_init方法的具体用法?Python Store.standard_init怎么用?Python Store.standard_init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geoprocessing.business_logic.business_objects.store.Store的用法示例。


在下文中一共展示了Store.standard_init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: 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 standard_init [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))
开发者ID:erezrubinstein,项目名称:aa,代码行数:30,代码来源:test_monopoly_transitions.py

示例2: 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 standard_init [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))
开发者ID:erezrubinstein,项目名称:aa,代码行数:28,代码来源:test_monopoly_transitions.py

示例3: test_closed_date_property

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_closed_date_property(self):
        # create three stores.  one with both dates, one with assumed date only, and one with no dates.
        # I kept start_dates in both just to verify the properties use the right internal field
        store_use_closed_date = Store.standard_init(1, 1, 1, None, None, None, None, "2012-01-01", "2012-12-01", "2012-01-02", "2012-12-02")
        store_use_assumed_closed_date = Store.standard_init(1, 1, 1, None, None, None, None, "2012-01-01", None, "2012-01-02", "2012-12-02")
        store_no_date = Store.standard_init(1, 1, 1, None, None, None, None, "2012-01-01", None, "2012-01-02", None)

        # verify that each store has the right opened_date
        self.assertEqual(store_use_closed_date.closed_date, "2012-12-01")
        self.assertEqual(store_use_assumed_closed_date.closed_date, "2012-12-02")
        self.assertIsNone(store_no_date.closed_date)
开发者ID:erezrubinstein,项目名称:aa,代码行数:13,代码来源:test_store.py

示例4: test_opened_date_property

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_opened_date_property(self):
        # create three stores.  one with both dates, one with assumed date only, and one with no dates.
        # I kept end_dates in both just to verify the properties use the right internal field
        store_use_opened_date = Store.standard_init(1, 1, 1, None, None, None, None, "2012-01-01", "2012-12-01", "2012-01-02", "2012-12-02")
        store_use_assumed_opened_date = Store.standard_init(1, 1, 1, None, None, None, None, None, "2012-12-01", "2012-01-02", "2012-12-02")
        store_use_assumed_opened_date_min_date = Store.standard_init(1, 1, 1, None, None, None, None, datetime(1900, 1, 1), "2012-12-01", "2012-01-02", "2012-12-02")
        store_use_assumed_opened_date_min_date_str = Store.standard_init(1, 1, 1, None, None, None, None, "1900-01-01", "2012-12-01", "2012-01-02", "2012-12-02")
        store_no_date = Store.standard_init(1, 1, 1, None, None, None, None, None, "2012-12-01", None, "2012-12-02")

        # verify that each store has the right opened_date
        self.assertEqual(store_use_opened_date.opened_date, "2012-01-01")
        self.assertEqual(store_use_assumed_opened_date.opened_date, "2012-01-02")
        self.assertEqual(store_use_assumed_opened_date_min_date.opened_date, "2012-01-02")
        self.assertEqual(store_use_assumed_opened_date_min_date_str.opened_date, "2012-01-02")
        self.assertIsNone(store_no_date.opened_date)
开发者ID:erezrubinstein,项目名称:aa,代码行数:17,代码来源:test_store.py

示例5: test_synchronize_monopolies__has_foreign_competitors_always

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_synchronize_monopolies__has_foreign_competitors_always(self):
        # create home store
        trade_area_id = 10
        start_date = datetime(2012, 1, 1)
        home_store = Store.standard_init(1, 1, -1, -1, None, None, None, datetime(2012, 2, 2), None, datetime(2012, 2, 2), None)

        # mock up different company competitive store
        start_date = datetime(2012, 1, 1)
        self._data_repository.competitive_stores[1] = [ StoreCompetitionInstance.standard_init(2, 2, 1, 1, 1, 1, start_date, None, start_date, None, None, None) ]

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        competitive_stores = CompetitiveStoreHelper(home_store, [], 10, self._data_repository)

        # call synchronize
        competitive_stores.synchronize_monopolies_in_db()

        # old monopolies deleted
        self.assertTrue(self._data_repository.monopolies_deleted)

        # nothing closed
        self.assertEqual(len(self._data_repository.closed_monopolies), 0)
        self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)

        # nothing added
        self.assertEqual(len(self._data_repository.upserted_monopolies), 0)
        self.assertEqual(len(self._data_repository.upserted_monopolies_batch_list), 0)

        # make sure the batch monopolies upsert was called
        self.assertEqual(self._data_repository.batch_upserted_monopolies_trade_area_id, 10)
        self.assertEqual(self._data_repository.batch_upserted_monopolies_list, [])
开发者ID:erezrubinstein,项目名称:aa,代码行数:32,代码来源:test_competitive_store_helper.py

示例6: test_insert_store_return_with_new_store_id

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_insert_store_return_with_new_store_id(self):
        try:
            # create fake company and address
            company_id = insert_test_company()
            address_id = insert_test_address(-40, 40)

            # create fake store
            store = Store.standard_init(None, company_id, address_id, "111-111-1111", "UNITTESTSTOREFORMAT", "UNITTESTCOMPANYGENERAGEDSTORENUMBER", "UNITETESTNOTE", None, None, "2012-02-02", None)

            # save store, which should initialize itself with the store_id and the change type
            store = self._SQL_data_repository.insert_store_return_with_new_store_id(store)

            # verify ID is set
            self.assertIsNotNone(store.store_id)

            # select store and verify fields
            store = Store.select_by_id(store.store_id)
            self.assertEqual(store.company_id, company_id)
            self.assertEqual(store.address_id, address_id)
            self.assertEqual(store.phone_number, "111-111-1111")
            self.assertEqual(store.note, "UNITETESTNOTE")
            self.assertEqual(store.store_format, "UNITTESTSTOREFORMAT")
            self.assertEqual(store.company_generated_store_number, "UNITTESTCOMPANYGENERAGEDSTORENUMBER")
            self.assertIsNone(store._opened_date)
            self.assertIsNone(store._closed_date)
            self.assertEqual(store._assumed_opened_date, datetime(2012, 2, 2))
            self.assertIsNone(store._assumed_closed_date)
        finally:
            delete_test_store(store.store_id)
            delete_test_address(address_id)
            delete_test_company(company_id)
开发者ID:erezrubinstein,项目名称:aa,代码行数:33,代码来源:test_store_data_access.py

示例7: test_synchronize_monopolies__complete_monopoly_always

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_synchronize_monopolies__complete_monopoly_always(self):
        # create home store
        trade_area_id = 10
        home_store = Store.standard_init(1, 1, -1, -1, None, None, None, datetime(2012, 2, 2), None, datetime(2012, 2, 2), None)

        # mock up empty competitive stores
        self._data_repository.competitive_stores[1] = []

        # create existing set of competitive stores, which consists of only one of the mock stores and a new competitor
        competitive_stores = CompetitiveStoreHelper(home_store, [], 10, self._data_repository)

        # call synchronize
        competitive_stores.synchronize_monopolies_in_db()

        # old monopolies deleted
        self.assertTrue(self._data_repository.monopolies_deleted)

        # nothing closed
        self.assertEqual(len(self._data_repository.closed_monopolies), 0)
        self.assertEqual(len(self._data_repository.closed_monopolies_batch_list), 0)

        # absolute monopoly added
        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.AbsoluteMonopoly)
        self.assertEqual(self._data_repository.upserted_monopolies_trade_areas[0], trade_area_id)
        # verify dates
        self.assertEqual(self._data_repository.upserted_monopolies_dates[0], datetime(2012, 2, 2))

        # make sure the batch monopolies upsert was called
        self.assertEqual(self._data_repository.batch_upserted_monopolies_trade_area_id, 10)
        self.assertEqual(self._data_repository.batch_upserted_monopolies_list, [])
开发者ID:erezrubinstein,项目名称:aa,代码行数:35,代码来源:test_competitive_store_helper.py

示例8: test_foreign_competitor_to_foreign_competitor_transition

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_foreign_competitor_to_foreign_competitor_transition(self):
        trade_area_id = 10
        home_store = Store.simple_init_with_address(1, 1, -1, -1)
        # still a foreign competitor
        new_away_stores = [Store.standard_init(3, 2, -1, 1, None, None, None, None, "2012-01-20", None, None)]
        # 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 nothing is done
        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)
开发者ID:erezrubinstein,项目名称:aa,代码行数:20,代码来源:test_monopoly_transitions.py

示例9: 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 standard_init [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)
开发者ID:erezrubinstein,项目名称:aa,代码行数:15,代码来源:test_monopoly_transitions.py

示例10: get_store_by_id

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
def get_store_by_id(store_id):
    statement= """
                    SELECT store_id, company_id, address_id, phone_number, store_format, company_generated_store_number, note, opened_date, closed_date, assumed_opened_date, assumed_closed_date
                    FROM stores where store_id = ?
               """
    stores = sql_execute_with_parameters([store_id], statement)
    if len(stores) == 0:

        raise Exception("Store id %s does not exist in db: " % (store_id))

    else:
        store = stores[0]
        return Store.standard_init(store.store_id, store.company_id, store.address_id, store.phone_number, store.store_format, store.company_generated_store_number,
            store.note, store.opened_date, store.closed_date, store.assumed_opened_date, store.assumed_closed_date)
开发者ID:erezrubinstein,项目名称:aa,代码行数:16,代码来源:store_handler.py

示例11: test_insert_store_return_with_new_store_id__different_phone_numbers

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_insert_store_return_with_new_store_id__different_phone_numbers(self):
        """
        two stores that have the same address id and company id but different phone numbers, make sure we get the right ones back
        """

        try:
            # create fake company and address
            company_id = insert_test_company()
            address_id = insert_test_address(-40, 40)

            # create fake store
            store = Store.standard_init(None, company_id, address_id, "111-111-1111", "UNITETESTFORMAT", None, None, None, None, "2012-02-02", None)
            store_2 = Store.standard_init(None, company_id, address_id, "111-111-1112", "UNITETESTFORMAT", None, None, None, None, "2012-02-02", None)

            # save store, which should initialize itself with the store_id and the change type
            store_returned = self._SQL_data_repository.insert_store_return_with_new_store_id(store)
            store_2_returned = self._SQL_data_repository.insert_store_return_with_new_store_id(store_2)

            self.assertIsNotNone(store.store_id)
            # verify store has id, correct fields, and correct change type
            self.assertEqual(store_returned.company_id, company_id)
            self.assertEqual(store_returned.address_id, address_id)
            self.assertEqual(store_returned.phone_number, "111-111-1111")
            self.assertIsNone(store_returned._opened_date)
            self.assertIsNone(store_returned._closed_date)
            self.assertEqual(store_returned._assumed_opened_date, "2012-02-02")
            self.assertIsNone(store_returned._assumed_closed_date)

            self.assertEqual(store_2_returned.phone_number, "111-111-1112")

        except:
            raise
        finally:
            delete_test_store(store.store_id)
            delete_test_store(store_2.store_id)
            delete_test_address(address_id)
            delete_test_company(company_id)
开发者ID:erezrubinstein,项目名称:aa,代码行数:39,代码来源:test_store_data_access.py

示例12: test_foreign_competitor_to_absolute_monopoly_transition

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_foreign_competitor_to_absolute_monopoly_transition(self):
        trade_area_id = 10
        home_store = Store.simple_init_with_address(1, 1, -1, -1)
        # no competitors
        new_away_stores = []
        # 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.AbsoluteMonopoly)
        self.assertEqual(self._data_repository.upserted_monopolies_trade_areas[0], trade_area_id)
        # verify date matches the largest of the previous away store
        # this is a key check because it verifies that it looks at all companies for the date (i.e. not just foreign competitors)
        self.assertEqual(self._data_repository.upserted_monopolies_dates[0], datetime(2012, 01, 30))
开发者ID:erezrubinstein,项目名称:aa,代码行数:26,代码来源:test_monopoly_transitions.py

示例13: test_absolute_monopoly_to_foreign_competitor_transition

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_absolute_monopoly_to_foreign_competitor_transition(self):
        trade_area_id = 10
        home_store = Store.simple_init_with_address(1, 1, -1, -1)
        # different company
        new_away_stores = [
            Store.standard_init(2, 1, -1, 1, None, None, None, "2012-01-30", None, None, None),
            Store.standard_init(3, 1, -1, 1, None, None, None, "2012-01-01", None, None, None),
            Store.standard_init(4, 2, -1, 1, None, None, None, "2012-01-20", 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 closed and none inserted
        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 start_date and end_date = earliest close_date from previous stores
        # 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.closed_monopolies_dates[0], datetime(2012, 01, 20))
开发者ID:erezrubinstein,项目名称:aa,代码行数:26,代码来源:test_monopoly_transitions.py

示例14: 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 standard_init [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))
开发者ID:erezrubinstein,项目名称:aa,代码行数:26,代码来源:test_monopoly_transitions.py

示例15: test_new_store_to_absolute_monopoly_transition

# 需要导入模块: from geoprocessing.business_logic.business_objects.store import Store [as 别名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import standard_init [as 别名]
    def test_new_store_to_absolute_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)
        new_away_stores = []
        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.AbsoluteMonopoly)
        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))
开发者ID:erezrubinstein,项目名称:aa,代码行数:19,代码来源:test_monopoly_transitions.py


注:本文中的geoprocessing.business_logic.business_objects.store.Store.standard_init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。