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


Python Player.look方法代码示例

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


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

示例1: test_look

# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import look [as 别名]
 def test_look(self):
     player = Player("fritz", "m")
     attic = Location("Attic", "A dark attic.")
     player.look()
     self.assertEqual(["[Limbo]\n", "The intermediate or transitional place or state. There's only nothingness.\nLiving beings end up here if they're not in a proper location yet.\n"], player.test_get_output_paragraphs())
     player.move(attic, silent=True)
     player.look(short=True)
     self.assertEqual(["[Attic]\n"], player.test_get_output_paragraphs())
     julie = NPC("julie", "f")
     julie.move(attic, silent=True)
     player.look(short=True)
     self.assertEqual(["[Attic]\n", "Present: julie\n"], player.test_get_output_paragraphs())
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:14,代码来源:test_player.py

示例2: test_look_brief

# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import look [as 别名]
 def test_look_brief(self):
     player = Player("fritz", "m")
     attic = Location("Attic", "A dark attic.")
     cellar = Location("Cellar", "A gloomy cellar.")
     julie = NPC("julie", "f")
     julie.move(attic, silent=True)
     player.move(attic, silent=True)
     player.brief = 0  # default setting: always long descriptions
     player.look()
     self.assertEqual(["[Attic]\n", "A dark attic.\n", "Julie is here.\n"], player.test_get_output_paragraphs())
     player.look()
     self.assertEqual(["[Attic]\n", "A dark attic.\n", "Julie is here.\n"], player.test_get_output_paragraphs())
     player.look(short=True)   # override
     self.assertEqual(["[Attic]\n", "Present: julie\n"], player.test_get_output_paragraphs())
     player.brief = 1  # short for known, long for new locations
     player.look()
     self.assertEqual(["[Attic]\n", "Present: julie\n"], player.test_get_output_paragraphs())
     player.move(cellar, silent=True)
     player.look()
     self.assertEqual(["[Cellar]\n", "A gloomy cellar.\n"], player.test_get_output_paragraphs())
     player.look()
     self.assertEqual(["[Cellar]\n"], player.test_get_output_paragraphs())
     player.brief = 2  # short always
     player.known_locations.clear()
     player.look()
     self.assertEqual(["[Cellar]\n"], player.test_get_output_paragraphs())
     player.move(attic, silent=True)
     player.look()
     self.assertEqual(["[Attic]\n", "Present: julie\n"], player.test_get_output_paragraphs())
     player.look(short=True)   # override
     self.assertEqual(["[Attic]\n", "Present: julie\n"], player.test_get_output_paragraphs())
     player.look(short=False)  # override
     self.assertEqual(["[Attic]\n", "A dark attic.\n", "Julie is here.\n"], player.test_get_output_paragraphs())
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:35,代码来源:test_player.py


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