Пример #1
0
def parse_single_target_command(user_input, player):
    command = user_input[0]
    if command in Constants.EXAMINE:
        return Commands.parse_examine_command(user_input, player)
    if command in Constants.TAKE:
        return Commands.parse_take_command(user_input, player)
    if command in Constants.TALK:
        return Commands.parse_talk_command(user_input, player)
    return Constants.INVALID_COMMAND_GIVEN_STRING
Пример #2
0
 def test_examine_command_item_not_found(self):
     user_input = ["examine", "test not present"]
     player = copy.copy(Test_Objects.TEST_PLAYER)
     expected = Constants.ITEM_NOT_VISIBLE_STRING + "test not present."
     actual = Commands.parse_examine_command(user_input, player)
     self.assertEqual(expected, actual)
Пример #3
0
 def test_examine_command_item_in_inventory(self):
     user_input = ["examine", "test"]
     player = copy.copy(Test_Objects.TEST_PLAYER)
     actual = Commands.parse_examine_command(user_input, player)
     self.assertEqual(Test_Objects.TEST_ITEM_IN_INVENTORY.long_desc, actual)
Пример #4
0
 def test_examine_command_with_keyword(self):
     user_input = ["examine", "keyword"]
     player = copy.copy(Test_Objects.TEST_PLAYER)
     actual = Commands.parse_examine_command(user_input, player)
     self.assertEqual(Test_Objects.TEST_ITEM_ON_GROUND.long_desc, actual)