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


Python BaseDataHandler._acquire_sample方法代码示例

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


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

示例1: test__acquire_sample_no_constraints

# 需要导入模块: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 别名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import _acquire_sample [as 别名]
    def test__acquire_sample_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_sample(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, config, update_new_data_check_attachment)
开发者ID:Bobfrat,项目名称:coi-services,代码行数:34,代码来源:test_base_data_handler.py

示例2: test__acquire_sample_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_sample [as 别名]
    def test__acquire_sample_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_sample(
            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:newbrough,项目名称:coi-services,代码行数:34,代码来源:test_base_data_handler.py


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