本文整理汇总了Python中cleo.application.Application._want_helps方法的典型用法代码示例。如果您正苦于以下问题:Python Application._want_helps方法的具体用法?Python Application._want_helps怎么用?Python Application._want_helps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cleo.application.Application
的用法示例。
在下文中一共展示了Application._want_helps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_has_get
# 需要导入模块: from cleo.application import Application [as 别名]
# 或者: from cleo.application.Application import _want_helps [as 别名]
def test_has_get(self):
"""
Application.has() and Application.get() should determine and get commands
"""
application = Application()
self.assertTrue(application.has("list"), msg=".has() returns true if a command is registered")
self.assertFalse(application.has("afoobar"), msg=".has() returns false if a command is not registered")
foo = FooCommand()
application.add(foo)
self.assertTrue(application.has("afoobar"), msg=".has() returns true if an alias is registered")
self.assertEqual(foo, application.get("foo:bar"), msg=".get() returns a command by name")
self.assertEqual(foo, application.get("afoobar"), msg=".get() returns a command by alias")
application = Application()
application.add(foo)
# Simulate help
application._want_helps = True
self.assertTrue(
isinstance(application.get("foo:bar"), HelpCommand),
msg=".get() returns the help command if --help is provided as the input",
)