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


Python MRJob.stdout方法代码示例

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


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

示例1: test_default

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import stdout [as 别名]
    def test_default(self):
        # test parsing JSON
        mr_job = MRJob()
        output = '0\t1\n"a"\t"b"\n'
        mr_job.stdout = StringIO(output)
        self.assertEqual(mr_job.parse_output(), [(0, 1), ('a', 'b')])

        # verify that stdout is not cleared
        self.assertEqual(mr_job.stdout.getvalue(), output)
开发者ID:Anihc,项目名称:mrjob,代码行数:11,代码来源:test_job.py

示例2: test_protocol_instance

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import stdout [as 别名]
    def test_protocol_instance(self):
        # see if we can use the repr protocol
        mr_job = MRJob()
        output = "0\t1\n['a', 'b']\tset(['c', 'd'])\n"
        mr_job.stdout = StringIO(output)
        self.assertEqual(mr_job.parse_output(ReprProtocol()), [(0, 1), (["a", "b"], set(["c", "d"]))])

        # verify that stdout is not cleared
        self.assertEqual(mr_job.stdout.getvalue(), output)
开发者ID:ndimiduk,项目名称:mrjob,代码行数:11,代码来源:test_job.py

示例3: test_parse_output

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import stdout [as 别名]
    def test_parse_output(self):
        # test parsing JSON
        mr_job = MRJob()
        output = b'0\t1\n"a"\t"b"\n'
        mr_job.stdout = BytesIO(output)
        with logger_disabled('mrjob.job'):
            self.assertEqual(mr_job.parse_output(), [(0, 1), ('a', 'b')])

        # verify that stdout is not cleared
        self.assertEqual(mr_job.stdout.getvalue(), output)
开发者ID:tempcyc,项目名称:mrjob,代码行数:12,代码来源:test_job.py

示例4: test_deprecated_protocol_aliases

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import stdout [as 别名]
    def test_deprecated_protocol_aliases(self):
        # see if we can use the repr protocol
        mr_job = MRJob()
        output = "0\t1\n['a', 'b']\tset(['c', 'd'])\n"
        mr_job.stdout = StringIO(output)
        assert_equal(mr_job.parse_output('repr'),
                     [(0, 1), (['a', 'b'], set(['c', 'd']))])

        # verify that stdout is not cleared
        assert_equal(mr_job.stdout.getvalue(), output)
开发者ID:gimlids,项目名称:LTPM,代码行数:12,代码来源:job_test.py

示例5: test_parse_output_with_protocol_instance

# 需要导入模块: from mrjob.job import MRJob [as 别名]
# 或者: from mrjob.job.MRJob import stdout [as 别名]
    def test_parse_output_with_protocol_instance(self):
        # see if we can use the repr protocol
        mr_job = MRJob()
        output = b"0\t1\n['a', 'b']\tset(['c', 'd'])\n"
        mr_job.stdout = BytesIO(output)
        with logger_disabled('mrjob.job'):
            self.assertEqual(mr_job.parse_output(ReprProtocol()),
                             [(0, 1), (['a', 'b'], set(['c', 'd']))])

        # verify that stdout is not cleared
        self.assertEqual(mr_job.stdout.getvalue(), output)
开发者ID:tempcyc,项目名称:mrjob,代码行数:13,代码来源:test_job.py


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