本文整理汇总了Python中output.Output.getinstance方法的典型用法代码示例。如果您正苦于以下问题:Python Output.getinstance方法的具体用法?Python Output.getinstance怎么用?Python Output.getinstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类output.Output
的用法示例。
在下文中一共展示了Output.getinstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import getinstance [as 别名]
def __init__(self, name, desc='You are in a maze of twisty passages, all alike', short_desc='a maze',
help='It looks like you are completely lost'):
self._name = str(name)
self._desc = str(desc)
self._short_desc = str(short_desc)
self._help = str(help)
self._connections = dict() # direction -> connection
self._output = Output.getinstance()
示例2: test_str
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import getinstance [as 别名]
def test_str(self):
name = 'Test Name'
obj = Output.getinstance()
method = obj.print_sentence
help_text = 'The print_sentence method of the Output singleton'
instance = Command(name, obj, method, help_text)
exp_result = name
result = str(instance)
self.assertEqual(exp_result, result)
示例3: test_call
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import getinstance [as 别名]
def test_call(self):
name = 'Test Name'
obj = Output.getinstance()
method = obj.get_sentence
help_text = 'The get_sentence method of the Output singleton'
instance = Command(name, obj, method, help_text)
exp_result = '\n Some format 5. '
result = instance('some format %d', 5)
self.assertEqual(exp_result, result)
示例4: test_init
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import getinstance [as 别名]
def test_init(self):
name = 'Test Name'
obj = Output.getinstance()
method = obj.print_sentence
help_text = 'The print_sentence method of the Output singleton'
instance = Command(name, obj, method, help_text)
exp_result = name
result = instance.name
self.assertEqual(exp_result, result)
exp_result = help
result = instance.help
self.assertEqual(exp_result, result)
exp_result = obj
result = instance._obj
self.assertEqual(exp_result, result)
exp_result = method
result = instance._method
self.assertEqual(exp_result, result)
示例5: __init__
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import getinstance [as 别名]
def __init__(self, directions, actions, aliases, errors):
self._directions = directions
self._actions = actions
self._aliases = aliases
self._errors = errors
self._output = Output.getinstance()