• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mmp_cds_base.MmpCdsParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mi.dataset.parser.mmp_cds_base.MmpCdsParser的典型用法代码示例。如果您正苦于以下问题:Python MmpCdsParser类的具体用法?Python MmpCdsParser怎么用?Python MmpCdsParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_get_many

    def test_get_many(self):
        """
        This test exercises retrieving 20 particles, verifying the 20th particle, then retrieves 30 particles
         and verifies the 30th particle.
        """

        with open(os.path.join(RESOURCE_PATH, 'ctd_1_20131124T005004_458.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(20)

            # Should end up with 20 particles
            self.assertTrue(len(particles) == 20)

            # the yml file only has particle 19 in it
            self.assert_particles(particles[19:20], 'get_many_one.yml', RESOURCE_PATH)

            particles = parser.get_records(30)

            # Should end up with 30 particles
            self.assertTrue(len(particles) == 30)

            # the yml file only has particle 29 in it
            self.assert_particles(particles[29:30], 'get_many_two.yml', RESOURCE_PATH)
开发者ID:JeffRoy,项目名称:mi-dataset,代码行数:25,代码来源:test_ctdpf_ckl_mmp_cds.py


示例2: test_bad_data_two

    def test_bad_data_two(self):
        """
        This test verifies that a SampleException is raised when an entire msgpack buffer is not msgpack.
        """

        with open(os.path.join(RESOURCE_PATH, 'not-msg-pack.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            parser.get_records(1)
            self.assertTrue(len(self.exception_callback_value) >= 1)
            self.assert_(isinstance(self.exception_callback_value[0], SampleException))
开发者ID:JeffRoy,项目名称:mi-dataset,代码行数:12,代码来源:test_ctdpf_ckl_mmp_cds.py


示例3: test_simple

    def test_simple(self):
        """
        This test reads in a small number of particles and verifies the result of one of the particles.
        """

        with open(os.path.join(RESOURCE_PATH, 'simple.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(1)

            self.assert_particles(particles, 'simple.yml', RESOURCE_PATH)
开发者ID:danmergens,项目名称:mi-instrument,代码行数:12,代码来源:test_optaa_ac_mmp_cds.py


示例4: test_bad_data_one

    def test_bad_data_one(self):
        """
        This test verifies that a SampleException is raised when msgpack data is malformed.
        """

        with open(os.path.join(RESOURCE_PATH, 'ctd_1_20131124T005004_BAD.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            parser.get_records(1)

            self.assertEqual(len(self.exception_callback_value), 1)
            self.assert_(isinstance(self.exception_callback_value[0], SampleException))
开发者ID:JeffRoy,项目名称:mi-dataset,代码行数:13,代码来源:test_ctdpf_ckl_mmp_cds.py


示例5: test_simple

    def test_simple(self):
        """
        This test reads in a small number of particles and verifies the result of one of the particles.
        """

        with open(os.path.join(RESOURCE_PATH, 'optode_1_20131124T005004_458.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(6)

            # the yml file only has particle 5 in it
            self.assert_particles(particles[5:6], 'good.yml', RESOURCE_PATH)
开发者ID:JeffRoy,项目名称:mi-dataset,代码行数:13,代码来源:test_dosta_abcdjm_mmp_cds.py


示例6: test_long_stream

    def test_long_stream(self):
        """
        This test exercises retrieve approximately 200 particles.
        """

        # Using two concatenated msgpack files to simulate two chunks to get more particles.
        with open(os.path.join(RESOURCE_PATH, 'ctd_concat.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            # Attempt to retrieve 200 particles, but we will retrieve less
            particles = parser.get_records(200)

            # Should end up with 172 particles
            self.assertEqual(len(particles), 172)
开发者ID:JeffRoy,项目名称:mi-dataset,代码行数:15,代码来源:test_ctdpf_ckl_mmp_cds.py


示例7: test_verify_with_yml

    def test_verify_with_yml(self):
        """
        This test exercises retrieving 4 particles and verifies them using a yml file
        """

        with open(os.path.join(RESOURCE_PATH, 'flcdr_1_20131124T005004_459.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(4)

            # Should end up with 4 particles
            self.assertTrue(len(particles) == 4)

            self.assert_particles(particles, 'first_four_cdr.yml', RESOURCE_PATH)
开发者ID:danmergens,项目名称:mi-instrument,代码行数:15,代码来源:test_flcdr_x_mmp_cds.py


示例8: test_long_stream

    def test_long_stream(self):
        """
        This test exercises retrieve approximately 200 particles.
        """

        with open(os.path.join(RESOURCE_PATH, 'large_import.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            # Attempt to retrieve 1000 particles
            particles = parser.get_records(1000)

            # Should end up with 1000 particles
            self.assertTrue(len(particles) == 1000)

            self.assert_particles(particles, 'large_import.yml', RESOURCE_PATH)
开发者ID:danmergens,项目名称:mi-instrument,代码行数:16,代码来源:test_optaa_ac_mmp_cds.py


示例9: test_get_many

    def test_get_many(self):
        """
        This test exercises retrieving 20 particles, verifying the 20th particle, then retrieves 30 particles
         and verifies the 30th particle.
        """

        with open(os.path.join(RESOURCE_PATH, 'get_many.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(50)

            # Should end up with 50 particles
            self.assertTrue(len(particles) == 50)

            self.assert_particles(particles, 'get_many.yml', RESOURCE_PATH)
开发者ID:danmergens,项目名称:mi-instrument,代码行数:16,代码来源:test_optaa_ac_mmp_cds.py


示例10: test_bad_data_one

    def test_bad_data_one(self):
        """
        This test verifies that a SampleException is raised when msgpack data is malformed.
        """

        with open(os.path.join(RESOURCE_PATH, 'acs_archive.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            particles = parser.get_records(100)

            self.assertTrue(len(particles) == 40)

        with open(os.path.join(RESOURCE_PATH, 'acs_archive_BAD.mpk'), 'rb') as stream_handle:

            parser = MmpCdsParser(self.config, stream_handle, self.exception_callback)

            parser.get_records(1)

            self.assertTrue(len(self.exception_callback_value) >= 1)
            self.assert_(isinstance(self.exception_callback_value[0], SampleException))
开发者ID:danmergens,项目名称:mi-instrument,代码行数:21,代码来源:test_optaa_ac_mmp_cds.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mopak_o_dcl.MopakODclParser类代码示例发布时间:2022-05-27
下一篇:
Python dosta_ln_wfp.DostaLnWfpParser类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap