def test_print_inventory_list(self, mock_output): test_list = [ "Gandalf", ["Strength", 1], ["Dexterity", 2], ["Constitution", 3], ["Intelligence", 4], ["Wisdom", 5], ["Charisma", 6], [ "sidesword", "rapier", "dagger", "longsword", "cloak of 'what the hell is this?'" ] ] expected_output = ("Gandalf\n" "Strength: 1!\n" "Dexterity: 2!\n" "Constitution: 3!\n" "Intelligence: 4!\n" "Wisdom: 5!\n" "Charisma: 6!\n" "sidesword\n" "rapier\n" "dagger\n" "longsword\n" "cloak of 'what the hell is this?'\n") Lab_05.print_character(test_list) self.assertEqual(mock_output.getvalue(), expected_output)
def test_print_character_attributes(self, mock_output): test_list = [ "Gandalf", ["Strength", 1], ["Dexterity", 2], ["Constitution", 3], ["Intelligence", 4], ["Wisdom", 5], ["Charisma", 6] ] expected_output = ("Gandalf\n" "Strength: 1!\n" "Dexterity: 2!\n" "Constitution: 3!\n" "Intelligence: 4!\n" "Wisdom: 5!\n" "Charisma: 6!\n") Lab_05.print_character(test_list) self.assertEqual(mock_output.getvalue(), expected_output)
def main(): print("********** WELCOME, adventurer!! **********") syl_count = input( "Forgot my glasses; can't read my attendance sheet..... how many syllables are in your name?" ) character = Lab_05.create_character(int(syl_count)) print("********** Welcome " + character[0] + "! Announce yourself!**********") print("Behold! I am the mighty " + character[0] + " - scourge of a place with an equally incomprehensible name.\n") print("My uproarious abilities:\n") print('####################') Lab_05.print_character(character) print('####################') items_list = [ "Rapier", "Broadsword", "Vorpal sword", "The constrictor", "A newt", "giant spoon", "icingdeath", "bag of holding", "boomstick", "stabstick" ] eq_count = input( "********** " + character[0] + ", I have " + str(len(items_list)) + " items for you! But, they're secret. How many you would like?**********\n " ) eq_count = int(eq_count) - 0 # enough of these f'ing string errors eq_list = [] if eq_count > len(items_list) or eq_count <= 0: Lab_05.choose_inventory(items_list, eq_count) elif eq_count > 0: character.append(Lab_05.choose_inventory(items_list, eq_count)) print( "********** You are a new person! Behold, world! I give you: **********\n " ) Lab_05.print_character(character)