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


Python BaseDataHandler._acquire_data方法代碼示例

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


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

示例1: test__acquire_data_with_constraints_testing_flag

# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import _acquire_data [as 別名]
    def test__acquire_data_with_constraints_testing_flag(
        self,
        _publish_data_mock,
        _get_data_mock,
        _init_acquisition_cycle_mock,
        EventPublisher_mock,
        _constraints_for_historical_request_mock,
    ):
        granule1 = Mock(spec=Granule)
        granule2 = Mock(spec=Granule)
        granule3 = Mock(spec=Granule)
        data_generator = [granule1, granule2, granule3]

        _get_data_mock.return_value = data_generator

        config = {"constraints": {"test_constraints": "value"}, "TESTING": True}
        publisher = Mock()
        unlock_new_data_callback = Mock()
        update_new_data_check_attachment = Mock()
        EventPublisher_mock.publish_event = Mock()
        BaseDataHandler._acquire_data(
            config=config,
            publisher=publisher,
            unlock_new_data_callback=unlock_new_data_callback,
            update_new_data_check_attachment=update_new_data_check_attachment,
        )

        _init_acquisition_cycle_mock.assert_called_once_with(config)
        _get_data_mock.assert_called_once_with(config)
        _publish_data_mock.assert_called_once_with(publisher, data_generator)
        _constraints_for_historical_request_mock.assert_called_once_with(config)
        EventPublisher_mock.publish_event.assert_called_once()
開發者ID:pombredanne,項目名稱:coi-services,代碼行數:34,代碼來源:test_base_data_handler.py

示例2: test__acquire_data_no_constraints

# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import _acquire_data [as 別名]
    def test__acquire_data_no_constraints(
        self,
        gevent_mock,
        _constraints_for_new_request_mock,
        _publish_data_mock,
        _get_data_mock,
        _init_acquisition_cycle_mock,
    ):
        granule1 = Mock(spec=Granule)
        granule2 = Mock(spec=Granule)
        granule3 = Mock(spec=Granule)
        data_generator = [granule1, granule2, granule3]

        gevent_mock.getcurrent = Mock()

        _constraints_for_new_request_mock.return_value = {"constraints": {"test_constraints": "value"}}
        _get_data_mock.return_value = data_generator

        config = {}
        publisher = Mock()
        unlock_new_data_callback = Mock()
        update_new_data_check_attachment = Mock()
        BaseDataHandler._acquire_data(
            config=config,
            publisher=publisher,
            unlock_new_data_callback=unlock_new_data_callback,
            update_new_data_check_attachment=update_new_data_check_attachment,
        )

        _init_acquisition_cycle_mock.assert_called_once_with(config)
        _constraints_for_new_request_mock.assert_called_once_with(config)
        _get_data_mock.assert_called_once_with(config)
        _publish_data_mock.assert_called_once_with(publisher, data_generator)
開發者ID:pombredanne,項目名稱:coi-services,代碼行數:35,代碼來源:test_base_data_handler.py

示例3: test__acquire_data_with_constraints

# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import _acquire_data [as 別名]
    def test__acquire_data_with_constraints(self, _publish_data_mock, _get_data_mock, _init_acquisition_cycle_mock):
        granule1 = Mock(spec=Granule)
        granule2 = Mock(spec=Granule)
        granule3 = Mock(spec=Granule)
        data_generator = [granule1, granule2, granule3]

        _get_data_mock.return_value = data_generator

        config = {'constraints' : 'test_constraints'}
        publisher = Mock()
        unlock_new_data_callback = Mock()
        BaseDataHandler._acquire_data(config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback)

        _init_acquisition_cycle_mock.assert_called_once_with(config)
        _get_data_mock.assert_called_once_with(config)
        _publish_data_mock.assert_called_once_with(publisher, data_generator)
開發者ID:dstuebe,項目名稱:coi-services,代碼行數:18,代碼來源:test_base_data_handler.py

示例4: test__acquire_data_with_constraints

# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import _acquire_data [as 別名]
    def test__acquire_data_with_constraints(self, _publish_data_mock, _get_data_mock, _init_acquisition_cycle_mock, _constraints_for_historical_request_mock):
        granule1 = Mock(spec=Granule)
        granule2 = Mock(spec=Granule)
        granule3 = Mock(spec=Granule)
        data_generator = [granule1, granule2, granule3]

        _get_data_mock.return_value = data_generator

        config = {'constraints' : {'test_constraints':'value'}}
        publisher = Mock()
        unlock_new_data_callback = Mock()
        update_new_data_check_attachment = Mock()
        BaseDataHandler._acquire_data(config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback, update_new_data_check_attachment=update_new_data_check_attachment)

        _init_acquisition_cycle_mock.assert_called_once_with(config)
        _constraints_for_historical_request_mock.assert_called_once_with(config)
        _get_data_mock.assert_called_once_with(config)
        _publish_data_mock.assert_called_once_with(publisher, data_generator)
開發者ID:kerfoot,項目名稱:coi-services,代碼行數:20,代碼來源:test_base_data_handler.py


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