I need assistance creating at least 5 unit tests, with at least two…
Question I need assistance creating at least 5 unit tests, with at least two… I need assistance creating at least 5 unit tests, with at least two different assert functions within the 5 unit tests. The Unit Tests should be based on the following classes: MenuItem, SalesForDay, & StrawberryStand within the StrawberryStand.py file. The unit tests will be housed in a separate .py file, which will import the unittest module and the ‘StrawberryStand.py’ file and make unit tests for each of the classes defined below in the reference section. Reference: class MenuItem: def __init__(self, name, wholesale_cost, selling_price): self.name = name self.wholesale_cost = wholesale_cost self.selling_price = selling_price def get_name(self): return self.name def get_wholesale_cost(self): return self.wholesale_cost def get_selling_price(self): return self.selling_priceclass SalesForDay: def __init__(self, day, sales_dict): self.day = day self.sales_dict = sales_dict def get_day(self): return self.day def get_sales_dict(self): return self.sales_dictclass StrawberryStand: def __init__(self, name): self.name = name self.current_day = 0 self.menu = {} self.sales_record = [] def get_name(self): return self.name def add_menu_item(self, menu_item): self.menu[menu_item.get_name()] = menu_item def enter_sales_for_today(self, sales_dict): for key in sales_dict: if key not in self.menu: raise InvalidSalesItemError self.sales_record.append(SalesForDay(self.current_day, sales_dict)) self.current_day += 1 def get_sales_dict_for_day(self, day): for sales_day in self.sales_record: if sales_day.get_day() == day: return sales_day.get_sales_dict() def total_sales_for_menu_item(self, menu_item_name): total_sales = 0 for sales_day in self.sales_record: total_sales += sales_day.get_sales_dict()[menu_item_name] return total_sales def total_profit_for_menu_item(self, menu_item_name): return self.menu[menu_item_name].get_selling_price() * self.total_sales_for_menu_item(menu_item_name) def total_profit_for_stand(self): total_profit = 0 for key in self.menu: total_profit += self.total_profit_for_menu_item(key) return total_profitclass InvalidSalesItemError(Exception): passstand = StrawberryStand(‘Straw R Us’)item1 = MenuItem(‘Strawberry’, .5, 1.5)stand.add_menu_item(item1)item2 = MenuItem(‘cake’, .2, 1)stand.add_menu_item(item2);day0 = { ‘Strawberry’: 5, ‘cake’: 2}stand.enter_sales_for_today(day0)print(f”Strawberry profit = {stand.total_profit_for_menu_item(‘Strawberry’)}”) Any help would be greatly appreciated! Computer Science Engineering & Technology Python Programming CPSP PYTHON Share QuestionEmailCopy link Comments (0)


