Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the `unittest` module's assertEqual and assertRaises functions to test the following situations: - Creating a student when 4 students already exist returns id of
Use the `unittest` module's assertEqual and assertRaises functions to test the following situations:
- Creating a student when 4 students already exist returns id of 5
- Adding a class on a day student has other classes that don't overlap is successful
- Adding a class that overlaps with another class throws an error
- Checking total class time when student has no classes returns 0
- Checking total class time when student has a bunch of classes scheduled returns correct number
12 main.py 1 import unittest 2 3 class Student: 4 def __init__(self, stu_name): 5 self.__name = stu_name 6 self._days_Time = dict() 7 8 def getName(self): 9 return self._name 10 11 def get_Days_Times(self): return self._days_Time 13 14 def set_The_Days_Times(self, list_days, list_times): 15 self._days_Time[list_days) - list_times 16 17 class Class: 18 #constructor 19 def __init__(self): 20 self.__student = [] 21 self._studentID = [] 22 #adds a student returns as id 23 24 def add_student(self, stu_name): 25 _id = len(self._studentID) 26 s - Student (stu_name) 27 self._student ID.append(_id+1) 28 self._student.append(s) 29 return _id+1 30 31 def add_class(self,_id, days_of_week, start_time, end_time): - 50 51 def total_class_time(self,_id): - 66 67 # Class_=Class() 68 # print (Class_add_student("Student 1")) 69 # print(Class_add_student("Student 2")) 70 # print(Class_add_student ("Student 3")) 71 # print(Class_add_student("Student 4")) 72 # Class_add_class (2,"TR", 1688, 1898) 73 # Class_add_class (2, "M", 1630,1800) 74 # print (Class_.total_class_time(2))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started