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


Python OptionParser.print_help方法代码示例

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


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

示例1: test_dash_underscore_introspection

# 需要导入模块: from tornado.options import OptionParser [as 别名]
# 或者: from tornado.options.OptionParser import print_help [as 别名]
    def test_dash_underscore_introspection(self):
        # Original names are preserved in introspection APIs.
        options = OptionParser()
        options.define('with-dash', group='g')
        options.define('with_underscore', group='g')
        all_options = ['help', 'with-dash', 'with_underscore']
        self.assertEqual(sorted(options), all_options)
        self.assertEqual(sorted(k for (k, v) in options.items()), all_options)
        self.assertEqual(sorted(options.as_dict().keys()), all_options)

        self.assertEqual(sorted(options.group_dict('g')),
                         ['with-dash', 'with_underscore'])

        # --help shows CLI-style names with dashes.
        buf = StringIO()
        options.print_help(buf)
        self.assertIn('--with-dash', buf.getvalue())
        self.assertIn('--with-underscore', buf.getvalue())
开发者ID:ArthurGarnier,项目名称:SickRage,代码行数:20,代码来源:options_test.py

示例2: test_dash_underscore_introspection

# 需要导入模块: from tornado.options import OptionParser [as 别名]
# 或者: from tornado.options.OptionParser import print_help [as 别名]
    def test_dash_underscore_introspection(self):
        # Original names are preserved in introspection APIs.
        options = OptionParser()
        options.define("with-dash", group="g")
        options.define("with_underscore", group="g")
        all_options = ["help", "with-dash", "with_underscore"]
        self.assertEqual(sorted(options), all_options)
        self.assertEqual(sorted(k for (k, v) in options.items()), all_options)
        self.assertEqual(sorted(options.as_dict().keys()), all_options)

        self.assertEqual(
            sorted(options.group_dict("g")), ["with-dash", "with_underscore"]
        )

        # --help shows CLI-style names with dashes.
        buf = StringIO()
        options.print_help(buf)
        self.assertIn("--with-dash", buf.getvalue())
        self.assertIn("--with-underscore", buf.getvalue())
开发者ID:bdarnell,项目名称:tornado,代码行数:21,代码来源:options_test.py


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