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


Python idlelib.FormatParagraph类代码示例

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


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

示例1: test_get_comment_header

 def test_get_comment_header(self):
     Equal = self.assertEqual
     Equal(fp.get_comment_header(self.test_comment), '#')
     Equal(fp.get_comment_header(self.trailingws_comment), '#')
     Equal(fp.get_comment_header(self.leadingws_comment), '    #')
     Equal(fp.get_comment_header(self.leadingws_nocomment), '    ')
     Equal(fp.get_comment_header(self.test_nocomment), '')
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:7,代码来源:test_formatparagraph.py

示例2: test_reformat_comment

 def test_reformat_comment(self):
     Equal = self.assertEqual
     test_string = '    """this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?"""'
     result = fp.reformat_comment(test_string, 70, '    ')
     expected = '    """this is a test of a reformat for a triple quoted string will it\n    reformat to less than 70 characters for me?"""'
     Equal(result, expected)
     test_comment = '# this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?'
     result = fp.reformat_comment(test_comment, 70, '#')
     expected = '# this is a test of a reformat for a triple quoted string will it\n# reformat to less than 70 characters for me?'
     Equal(result, expected)
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:10,代码来源:test_formatparagraph.py

示例3: runcase

    def runcase(self, inserttext, stopline, expected):
        text = self.text
        text.insert('1.0', inserttext)
        for line in range(1, stopline):
            linelength = int(text.index('%d.end' % line).split('.')[1])
            for col in (0, linelength // 2, linelength):
                tempindex = '%d.%d' % (line, col)
                self.assertEqual(fp.find_paragraph(text, tempindex), expected)

        text.delete('1.0', 'end')
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:10,代码来源:test_formatparagraph.py

示例4: runcase

 def runcase(self, inserttext, stopline, expected):
     # Check that find_paragraph returns the expected paragraph when
     # the mark index is set to beginning, middle, end of each line
     # up to but not including the stop line
     text = self.text
     text.insert('1.0', inserttext)
     for line in range(1, stopline):
         linelength = int(text.index("%d.end" % line).split('.')[1])
         for col in (0, linelength//2, linelength):
             tempindex = "%d.%d" % (line, col)
             self.assertEqual(fp.find_paragraph(text, tempindex), expected)
     text.delete('1.0', 'end')
开发者ID:amygdalama,项目名称:nagini,代码行数:12,代码来源:test_formatparagraph.py

示例5: test_reformat_comment

    def test_reformat_comment(self):
        Equal = self.assertEqual

        # reformat_comment formats to a minimum of 20 characters
        test_string = (
            "    \"\"\"this is a test of a reformat for a triple quoted string"
            " will it reformat to less than 70 characters for me?\"\"\"")
        result = fp.reformat_comment(test_string, 70, "    ")
        expected = (
            "    \"\"\"this is a test of a reformat for a triple quoted string will it\n"
            "    reformat to less than 70 characters for me?\"\"\"")
        Equal(result, expected)

        test_comment = (
            "# this is a test of a reformat for a triple quoted string will "
            "it reformat to less than 70 characters for me?")
        result = fp.reformat_comment(test_comment, 70, "#")
        expected = (
            "# this is a test of a reformat for a triple quoted string will it\n"
            "# reformat to less than 70 characters for me?")
        Equal(result, expected)
开发者ID:amygdalama,项目名称:nagini,代码行数:21,代码来源:test_formatparagraph.py

示例6: test_is_all_white

 def test_is_all_white(self):
     self.assertTrue(fp.is_all_white(''))
     self.assertTrue(fp.is_all_white('\t\n\r\x0c\x0b'))
     self.assertFalse(fp.is_all_white(self.test_comment))
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:4,代码来源:test_formatparagraph.py


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