예제 #1
0
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)
예제 #2
0
 def test_choose_inventory_equal(self):
     self.assertEqual([inventory], choose_inventory([inventory], 1))
예제 #3
0
 def test_choose_inventory_over(self):
     self.assertEqual([inventory], choose_inventory([inventory], 2))
예제 #4
0
 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)
예제 #5
0
 def test_choose_inventory_empty(self):
     self.assertEqual([], choose_inventory([], 2))
예제 #6
0
 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)