def display_dishes(): """ Displays the dish section """ print("\n==========\nDISH IDEAS\n==========") load_dishes() change_dish = input( "Would you like to edit the list of dishes?\nY/N - Input here: ") if change_dish.lower() == "yes" or change_dish.lower() == "y": action = input( "What would you like to do?\n1: Add a dish to list\n2: Remove a dish from the list\n3: Go back\n=>" ) if action == "1": dish_id, dish_name, dish_price = input( "To add a dish, please use this format:\nDDD(for dish_id), name, price\n=> " ).split(", ") print(dish_id, dish_name, dish_price) items.add_item(dish_id, dish_name, dish_price) print("Dish added to list!") save_dish() display_dishes() elif action == "2": dish_id = input( "Please input the 3-letter code of the dish you wish to remove: " ) items.remove_item(dish_id) print("Dish removed!") save_dish() display_dishes() else: display_dishes() else: display_menu_interface()
def test_int_for_price(self): with self.assertRaises(TypeError): it.add_item('TST', 'Testan', 'LOL')
def test_bad_id(self): with self.assertRaises(exc.IDError): it.add_item('TSTAN', 'Testan', 10)
def test_add_dish_success(self): it.menu_idea = {} it.add_item('TST', 'Test', 10) actual = it.menu_idea expected = {'TST': {'name': 'Test', 'price': 10}} self.assertDictEqual(actual, expected)
def add_dish(self, event): it.add_item(self.add_id.get(), self.add_name.get(), int(self.add_price.get())) self.update_dishes()