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


Python TidyWriter.write方法代码示例

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


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

示例1: test_newlines_compressed_in_single_write

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_newlines_compressed_in_single_write(self):
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("test stuff\n\n\ntest\n")
        tidy_writer.close()

        self.assertEqual("test stuff\n\ntest\n", output.getvalue())
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:10,代码来源:test_repolib.py

示例2: test_compression_preserves_a_single_blank_line

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_compression_preserves_a_single_blank_line(self):
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("test stuff\n\ntest\n")
        tidy_writer.close()

        self.assertEqual("test stuff\n\ntest\n", output.getvalue())
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:10,代码来源:test_repolib.py

示例3: test_just_newlines_compressed_to_one

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_just_newlines_compressed_to_one(self):
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("\n\n\n\n")
        tidy_writer.close()

        self.assertEqual("\n", output.getvalue())
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:10,代码来源:test_repolib.py

示例4: test_newline_preserved_on_eof

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_newline_preserved_on_eof(self):
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("a line\n")
        tidy_writer.write("another line\n")
        tidy_writer.close()

        self.assertEqual("a line\nanother line\n", output.getvalue())
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:11,代码来源:test_repolib.py

示例5: test_newline_added_to_eof

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_newline_added_to_eof(self):
        output = StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("a line\n")
        tidy_writer.write("another line")
        tidy_writer.close()

        self.assertEquals("a line\nanother line\n", output.getvalue())
开发者ID:cnsnyder,项目名称:subscription-manager,代码行数:11,代码来源:test_repolib.py

示例6: test_newlines_compressed_across_writes

# 需要导入模块: from subscription_manager.repolib import TidyWriter [as 别名]
# 或者: from subscription_manager.repolib.TidyWriter import write [as 别名]
    def test_newlines_compressed_across_writes(self):
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("test stuff\n\n")
        tidy_writer.write("\ntest\n")
        tidy_writer.close()

        self.assertEqual("test stuff\n\ntest\n", output.getvalue())

        # now try the other split
        output = six.StringIO()
        tidy_writer = TidyWriter(output)

        tidy_writer.write("test stuff\n")
        tidy_writer.write("\n\ntest\n")
        tidy_writer.close()

        self.assertEqual("test stuff\n\ntest\n", output.getvalue())
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:21,代码来源:test_repolib.py


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