本文整理汇总了Python中tale.player.Player.brief方法的典型用法代码示例。如果您正苦于以下问题:Python Player.brief方法的具体用法?Python Player.brief怎么用?Python Player.brief使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tale.player.Player
的用法示例。
在下文中一共展示了Player.brief方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_look_brief
# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import brief [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())