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


Python Output.getinstance方法代码示例

本文整理汇总了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()
开发者ID:tdvance,项目名称:TextAdventureGame,代码行数:10,代码来源:room.py

示例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)
开发者ID:tdvance,项目名称:TextAdventureGame,代码行数:11,代码来源:test_action.py

示例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)
开发者ID:tdvance,项目名称:TextAdventureGame,代码行数:11,代码来源:test_action.py

示例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)
开发者ID:tdvance,项目名称:TextAdventureGame,代码行数:20,代码来源:test_action.py

示例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()
开发者ID:tdvance,项目名称:TextAdventureGame,代码行数:8,代码来源:input_parser.py


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