def test_add(self): student = home2_2.Student(home2_2.Person()) teacher = home2_2.Teacher(home2_2.Person()) classroom = home2_2.ClassRoom([student, student]) school = home2_2.School() self.assertEqual(school.add_techer(teacher), True) self.assertEqual(len(school.teachers), 1) self.assertEqual(school.add_class(classroom), True) self.assertEqual(len(school.classrooms), 1) self.assertEqual(school.add_class(teacher), False)
def test_get_lesons_count(self): schedule = home2_2.Schedule( home2_2.Leson("axqwcc", home2_2.Teacher(home2_2.Person()), "math"), datetime.date.today(), 105) student = home2_2.Student(home2_2.Person()) schedule.set_absent(student) schedules = home2_2.Schedules() schedules.add_schedule(schedule) self.assertEqual(schedules.get_lesons_count(datetime.date.today()), 1) self.assertEqual( len(schedules.get_absents(datetime.date.today(), "math")), 1)
def test_init(self): student = home2_2.Student(home2_2.Person()) classroom = home2_2.ClassRoom(student) self.assertEqual(len(classroom.studentList), 0) classroom = home2_2.ClassRoom([student]) self.assertEqual(len(classroom.studentList), 1)
def test__init(self): student = home2_2.Student(home2_2.Person()) self.assertIsInstance(student, home2_2.Student)
def test_is_teenager(self): pers = home2_2.Person(datetime.date(1999, 12, 23), "first", "Last") #print(pers.get_age()) self.assertEqual(home2_2.Person.is_teenager(pers), False)
def test_init(self): pers = home2_2.Person(datetime.date(1999, 12, 23), "first", "Last") self.assertIsInstance(pers.get_age(), int)
def test_get_teachers(self): teacher = home2_2.Teacher(home2_2.Person()) school = home2_2.School() school.add_techer(teacher, "math") school.add_techer(teacher, "math") self.assertEqual(len(home2_2.School.get_teachers(school, "math")), 2)
def test_addStudent(self): classroom = home2_2.ClassRoom() self.assertEqual(len(classroom.studentList), 0) classroom.addStudent(home2_2.Student(home2_2.Person())) self.assertEqual(len(classroom.studentList), 1)