def test_buy_multiple_things(self, mock_stdout, mock_inputs): actual = {'Name': 'Sasi', 'Strength': 10, 'Intelligence': 5, 'Wisdom': 7, 'Dexterity': 9, 'Constitution': 20, 'Charisma': 9, 'inventory': [], 'XP': 0, 'class': 'sorcerer', 'Race': 'Elf', 'HP': [6, 6]} dnd.choose_inventory(actual) expected = {'Charisma': 9, 'Constitution': 20, 'Dexterity': 9, 'HP': [6, 6], 'Intelligence': 5, 'Name': 'Sasi', 'Race': 'Elf', 'Strength': 10, 'Wisdom': 7, 'class': 'sorcerer', 'XP': 0, 'inventory': ['sword', 'Iris(sword)', 'W870 Shotgun', 'Crystal Carillon']} self.assertEqual(actual, expected)
def test_buy_nothing(self, mock_stdout, mock_inputs): actual = {'Name': 'Sasi', 'Strength': 10, 'Intelligence': 5, 'Wisdom': 7, 'Dexterity': 9, 'Constitution': 20, 'Charisma': 9, 'inventory': [], 'XP': 0, 'class': 'sorcerer', 'Race': 'Elf', 'HP': [6, 6]} dnd.choose_inventory(actual) expected = {'Charisma': 9, 'Constitution': 20, 'Dexterity': 9, 'HP': [6, 6], 'Intelligence': 5, 'Name': 'Sasi', 'Race': 'Elf', 'Strength': 10, 'Wisdom': 7, 'class': 'sorcerer', 'XP': 0, 'inventory': []} self.assertEqual(actual, expected)
def test_choose_inventory_multiple_NaN(self, _): char_one = {"Name": "Solar", "Strength": 26, "Intelligence": 25, "Wisdom": 25, "Dexterity": 14, "Constitution": 26, "Charisma": 30, "Inventory": [], "XP": 33000, "Class": "paladin", "Race": "human", "HP": [35, 5]} dnd.choose_inventory(char_one) actual = char_one["Inventory"] expected = [] self.assertEqual(actual, expected)
def test_choose_inventory_character_has_items(self, _): char_one = {"Name": "Solar", "Strength": 26, "Intelligence": 25, "Wisdom": 25, "Dexterity": 14, "Constitution": 26, "Charisma": 30, "Inventory": ["Legendary spanakopita"], "XP": 33000, "Class": "paladin", "Race": "human", "HP": [35, 5]} dnd.choose_inventory(char_one) actual = char_one["Inventory"] expected = ["Legendary spanakopita", "Ring of Three Wishes", "Potion Seller's Store", "Ring of Three Wishes", "Your Local Politician", "Chris Thompson's Shorts (his favorite beige pair)"] self.assertEqual(actual, expected)
def test_choose_inventory_multiple_different_purchases(self, _): char_one = {"Name": "Solar", "Strength": 26, "Intelligence": 25, "Wisdom": 25, "Dexterity": 14, "Constitution": 26, "Charisma": 30, "Inventory": [], "XP": 33000, "Class": "paladin", "Race": "human", "HP": [35, 5]} dnd.choose_inventory(char_one) actual = char_one["Inventory"] expected = ["Ring of Three Wishes", "Your Local Politician", "Potion Seller's Store", "A Spherical Muffin Where There Is Only Top-Muffin"] self.assertEqual(actual, expected)
def test_choose_inventory(self, _): character = { "Name": "Xyxy", "Strength": 10, "Dexterity": 8, "Intelligence": 5, "Charisma": 9, "Wisdom": 7, "Constitution": 3, "Inventory": [], "XP": 0, "Class": "monk", "Race": "elf", "HP": [7, 7] } dnd.choose_inventory(character) self.assertEqual([ 'Thumbtacks of blindness', 'Double edged dagger', 'Double edged dagger' ], character["Inventory"])