當前位置: 首頁>>代碼示例>>Python>>正文


Python BuildManPage.ManPageFormatter類代碼示例

本文整理匯總了Python中coalib.misc.BuildManPage.ManPageFormatter的典型用法代碼示例。如果您正苦於以下問題:Python ManPageFormatter類的具體用法?Python ManPageFormatter怎麽用?Python ManPageFormatter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ManPageFormatter類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_mk_footer

 def test_mk_footer(self):
     uut = ManPageFormatter(app_name, ext_sections=sections)
     self.assertEqual(uut._mk_footer(),
                      ".SH {0}\n"
                      " {1}".format(section_name.upper(), section_text))
     uut = ManPageFormatter(app_name, ext_sections=None)
     self.assertEqual(uut._mk_footer(), "")
開發者ID:VCTLabs,項目名稱:coala,代碼行數:7,代碼來源:BuildManPageTest.py

示例2: test_formatter

    def test_formatter(self):
        parser = test_arg_parser(ManPageFormatter)
        self.assertEqual(
            parser.format_help(),
            "usage: {0} [-h] [-a A] arg1\n\n{1}\n\n"
            "positional arguments:\n"
            "  arg1\n\n"
            "optional arguments:\n"
            "  \\fB-h\\fR, \\fB--help\\fR\n"
            "                        show this help message and exit\n"
            "  \\fB-a\\fR \\fIA\\fR\n"
            .format(app_name, app_description))

        parser = ManPageFormatter(app_name,
                                  parser=argparse.ArgumentParser(prog=app_name))
        today = datetime.date.today().strftime('%Y\\-%m\\-%d')
        self.assertEqual(parser.format_man_page(),
                         ".TH {0} 1 {1}\n"
                         ".SH NAME\n"
                         "{0}\n"
                         ".SH SYNOPSIS\n"
                         " \\fBname\\fR [-h]\n\n\n"
                         ".SH OPTIONS\n"
                         "  -h, --help  show this help message and exit\n"
                         .format(app_name, today))
開發者ID:VCTLabs,項目名稱:coala,代碼行數:25,代碼來源:BuildManPageTest.py

示例3: test_format_functions

 def test_format_functions(self):
     uut = ManPageFormatter(app_name)
     self.assertEqual(ManPageFormatter._markup("a-b"), "a\\-b")
     self.assertEqual(ManPageFormatter._underline("test"), "\\fItest\\fR")
     self.assertEqual(ManPageFormatter._bold("test"), "\\fBtest\\fR")
     self.assertEqual(ManPageFormatter._bold("\\fBtest"), "\\fBtest\\fR")
     self.assertEqual(ManPageFormatter._bold("test\\fR"), "\\fBtest\\fR")
開發者ID:VCTLabs,項目名稱:coala,代碼行數:7,代碼來源:BuildManPageTest.py

示例4: test_mk_options

 def test_mk_options(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(uut._mk_options(),
                      ".SH OPTIONS\n"
                      "  arg1\n\n"
                      "  -h, --help  show this help message and exit\n"
                      "  -a A\n")
開發者ID:VCTLabs,項目名稱:coala,代碼行數:7,代碼來源:BuildManPageTest.py

示例5: test_mk_description

 def test_mk_description(self):
     uut = ManPageFormatter(app_name,
                            parser=test_arg_parser())
     self.assertEqual(uut._mk_description(), "")
     uut = ManPageFormatter(app_name,
                            parser=test_arg_parser(),
                            long_desc=app_long_description)
     self.assertEqual(uut._mk_description(),
         ".SH DESCRIPTION\n{}\n".format(app_long_description))
開發者ID:VCTLabs,項目名稱:coala,代碼行數:9,代碼來源:BuildManPageTest.py

示例6: test_mk_synopsis

 def test_mk_synopsis(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(
         uut._mk_synopsis(),
         ".SH SYNOPSIS\n \\fB{}\\fR [-h] [-a A] arg1\n\n\n".format(app_name))
開發者ID:VCTLabs,項目名稱:coala,代碼行數:5,代碼來源:BuildManPageTest.py

示例7: test_mk_name

 def test_mk_name(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(uut._mk_name(),
                      ".SH NAME\n{}\n".format(app_name))
開發者ID:VCTLabs,項目名稱:coala,代碼行數:4,代碼來源:BuildManPageTest.py

示例8: test_mk_title

 def test_mk_title(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     today = datetime.date.today().strftime('%Y\\-%m\\-%d')
     self.assertEqual(uut._mk_title(),
                      '.TH {0} {1} {2}\n'.format(app_name, 1, today))
開發者ID:VCTLabs,項目名稱:coala,代碼行數:5,代碼來源:BuildManPageTest.py

示例9: test_format_functions

 def test_format_functions(self):
     self.assertEqual(ManPageFormatter._markup('a-b'), 'a\\-b')
     self.assertEqual(ManPageFormatter._underline('test'), '\\fItest\\fR')
     self.assertEqual(ManPageFormatter._bold('test'), '\\fBtest\\fR')
     self.assertEqual(ManPageFormatter._bold('\\fBtest'), '\\fBtest\\fR')
     self.assertEqual(ManPageFormatter._bold('test\\fR'), '\\fBtest\\fR')
開發者ID:Anmolbansal1,項目名稱:coala,代碼行數:6,代碼來源:BuildManPageTest.py


注:本文中的coalib.misc.BuildManPage.ManPageFormatter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。