예제 #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)