當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。