def main(): print("\n") print(f"Welcome to the shop! Here is our selection: \n {inventory}") print("\n") my_inventory = choose_inventory(inventory, 5) print(f"From our selection you've chosen: {my_inventory}") print("\n") my_character = create_character(2) my_character.append(my_inventory) print_character(my_character)
def test_choose_inventory_equal(self): self.assertEqual([inventory], choose_inventory([inventory], 1))
def test_choose_inventory_over(self): self.assertEqual([inventory], choose_inventory([inventory], 2))
def test_choose_inventory_print_over(self, mock_stdout): output = "You are over encumbered.\n" choose_inventory([inventory], 4) self.assertEqual(mock_stdout.getvalue(), output)
def test_choose_inventory_empty(self): self.assertEqual([], choose_inventory([], 2))
def test_choose_inventory_print_negative(self, mock_stdout): output = "Hey! You can't have negative items!\n" choose_inventory([inventory], -1) self.assertEqual(mock_stdout.getvalue(), output)