當前位置: 首頁>>代碼示例>>Python>>正文


Python Store.mismatched_parameters方法代碼示例

本文整理匯總了Python中geoprocessing.business_logic.business_objects.store.Store.mismatched_parameters方法的典型用法代碼示例。如果您正苦於以下問題:Python Store.mismatched_parameters方法的具體用法?Python Store.mismatched_parameters怎麽用?Python Store.mismatched_parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在geoprocessing.business_logic.business_objects.store.Store的用法示例。


在下文中一共展示了Store.mismatched_parameters方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_save_stores_to_change_log

# 需要導入模塊: from geoprocessing.business_logic.business_objects.store import Store [as 別名]
# 或者: from geoprocessing.business_logic.business_objects.store.Store import mismatched_parameters [as 別名]
    def test_save_stores_to_change_log(self):
            try:
                # insert a new file into the db
                source_file_id = self._data_repository.insert_source_file("UNITTEST_FILE_PATH", "2012-01-01", 1000)

                # create 5 fake stores
                company_id = insert_test_company()
                address_id = insert_test_address(-40, 40)
                store_id1 = insert_test_store(company_id, address_id)
                store_id2 = insert_test_store(company_id, address_id)
                store_id3 = insert_test_store(company_id, address_id)
                store_id4 = insert_test_store(company_id, address_id)
                store_id5 = insert_test_store(company_id, address_id)

                # create list of 2 deleted stores
                deleted_store_ids = [store_id1, store_id2]

                # create list of 3 changed stores
                store3 = Store()
                store3.store_id = store_id3
                store3.change_type = StoreChangeType.StoreConfirmed
                store3.mismatched_parameters = []
                store4 = Store()
                store4.store_id = store_id4
                store4.change_type = StoreChangeType.StoreUpdated
                store4.mismatched_parameters = ['chicken', 'beef']
                store5 = Store()
                store5.store_id = store_id5
                store5.change_type = StoreChangeType.StoreOpened
                store5.mismatched_parameters = []
                changed_stores = [store3, store4, store5]

                # add the change_longs for the 5 stores (2 deleted, one opened, one confirmed, one updated)
                source_file_id = self._data_repository.save_stores_to_change_log(deleted_store_ids, changed_stores, "2012-01-01", source_file_id)

                # select the change log entries and verify their contents
                change_logs = select_stores_change_log_entries(source_file_id)
                # verify deleted stores
                # store 1
                self.assertEqual(len(change_logs), 5)
                self.assertEqual(change_logs[0].store_id, store_id1)
                self.assertEqual(change_logs[0].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[0].change_type_id, StoreChangeType.StoreClosed)
                self.assertIsNone(change_logs[0].comment)
                self.assertEqual(change_logs[0].source_file_id, source_file_id)
                # store 2
                self.assertEqual(change_logs[1].store_id, store_id2)
                self.assertEqual(change_logs[1].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[1].change_type_id, StoreChangeType.StoreClosed)
                self.assertIsNone(change_logs[1].comment)
                self.assertEqual(change_logs[1].source_file_id, source_file_id)
                # store 3
                self.assertEqual(change_logs[2].store_id, store_id3)
                self.assertEqual(change_logs[2].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[2].change_type_id, StoreChangeType.StoreConfirmed)
                self.assertEqual(change_logs[2].comment, '[]')
                self.assertEqual(change_logs[2].source_file_id, source_file_id)
                # store 4
                self.assertEqual(change_logs[3].store_id, store_id4)
                self.assertEqual(change_logs[3].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[3].change_type_id, StoreChangeType.StoreUpdated)
                self.assertEqual(change_logs[3].comment, "['chicken', 'beef']")
                self.assertEqual(change_logs[3].source_file_id, source_file_id)
                # store 5
                self.assertEqual(change_logs[4].store_id, store_id5)
                self.assertEqual(change_logs[4].log_date, datetime(2012, 1, 1))
                self.assertEqual(change_logs[4].change_type_id, StoreChangeType.StoreOpened)
                self.assertEqual(change_logs[4].comment, "[]")
                self.assertEqual(change_logs[4].source_file_id, source_file_id)
            except:
                raise
            finally:
                delete_store_change_logs_by_source_file_id(source_file_id)
                delete_test_source_file(source_file_id)
                delete_test_store(store_id1)
                delete_test_store(store_id2)
                delete_test_store(store_id3)
                delete_test_store(store_id4)
                delete_test_store(store_id5)
                delete_test_address(address_id)
                delete_test_company(company_id)
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:83,代碼來源:test_change_log_data_access.py


注:本文中的geoprocessing.business_logic.business_objects.store.Store.mismatched_parameters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。