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


Python WfpEngStcImodemParser.set_state方法代码示例

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


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

示例1: WfpEngStcImodemParserUnitTestCase

# 需要导入模块: from mi.dataset.parser.wfp_eng__stc_imodem import WfpEngStcImodemParser [as 别名]
# 或者: from mi.dataset.parser.wfp_eng__stc_imodem.WfpEngStcImodemParser import set_state [as 别名]

#.........这里部分代码省略.........
        result = self.parser.get_records(1)
        self.assert_result(result, 128, self.particle_d_eng_telem, True)

    def test_mid_state_start_recovered(self):
        """
        Test starting the parser in a state in the middle of processing
        """
        new_state = {StateKey.POSITION:76}
        self.stream_handle = StringIO(WfpEngStcImodemParserUnitTestCase.TEST_DATA_SHORT)
        self.parser = WfpEngStcImodemParser(
            self.config.get(DataTypeKey.WFP_ENG_STC_IMODEM_RECOVERED), new_state, self.stream_handle,
            self.state_callback, self.pub_callback)

        result = self.parser.get_records(1)
        self.assert_result(result, 102, self.particle_c_eng_recov, False)
        result = self.parser.get_records(1)
        self.assert_result(result, 128, self.particle_d_eng_recov, True)

    def test_mid_state_start_telemetered(self):
        """
        Test starting the parser in a state in the middle of processing
        """
        new_state = {StateKey.POSITION:76}
        self.stream_handle = StringIO(WfpEngStcImodemParserUnitTestCase.TEST_DATA_SHORT)
        self.parser = WfpEngStcImodemParser(
            self.config.get(DataTypeKey.WFP_ENG_STC_IMODEM_TELEMETERED), new_state, self.stream_handle,
            self.state_callback, self.pub_callback)

        result = self.parser.get_records(1)
        self.assert_result(result, 102, self.particle_c_eng_telem, False)
        result = self.parser.get_records(1)
        self.assert_result(result, 128, self.particle_d_eng_telem, True)

    def test_set_state_recovered(self):
        """
        Test changing to a new state after initializing the parser and 
        reading data, as if new data has been found and the state has
        changed
        """
        new_state = {StateKey.POSITION: 76}
        self.stream_handle = StringIO(WfpEngStcImodemParserUnitTestCase.TEST_DATA_SHORT)
        self.parser = WfpEngStcImodemParser(
            self.config.get(DataTypeKey.WFP_ENG_STC_IMODEM_RECOVERED), self.start_state, self.stream_handle,
            self.state_callback, self.pub_callback)

        # start with the start time record
        result = self.parser.get_records(1)
        self.assert_result(result, 24, self.particle_a_start_time_recov, False)

        # set the new state, the essentially skips engineering a and b
        self.parser.set_state(new_state)
        result = self.parser.get_records(1)
        self.assert_result(result, 102, self.particle_c_eng_recov, False)
        result = self.parser.get_records(1)
        self.assert_result(result, 128, self.particle_d_eng_recov, True)

    def test_set_state_telemetered(self):
        """
        Test changing to a new state after initializing the parser and
        reading data, as if new data has been found and the state has
        changed
        """
        new_state = {StateKey.POSITION: 76}
        self.stream_handle = StringIO(WfpEngStcImodemParserUnitTestCase.TEST_DATA_SHORT)
        self.parser = WfpEngStcImodemParser(
            self.config.get(DataTypeKey.WFP_ENG_STC_IMODEM_TELEMETERED), self.start_state, self.stream_handle,
开发者ID:JeffRoy,项目名称:marine-integrations,代码行数:70,代码来源:test_wfp_eng__stc_imodem.py


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