def test_b1_sum_times(self): """[Lab 7] - [Investigation 1] - [Part 1] - Test for sum_times() - should provide the correct output""" error_fail = 'sum_times() in lab7a.py contains errors(HINT: run the lab7a1.py script and fix errors)' error_output = 'your lab7a.py has an error(HINT: sum_times() does not have correct return values)' try: import lab7a as lab7aStudent time1 = lab7aStudent.Time(9, 50, 0) time2 = lab7aStudent.Time(1, 1, 1) timeSum = lab7aStudent.sum_times(time1, time2) result = lab7aStudent.format_time(timeSum) except: self.fail(error_fail) answer = '10:51:01' self.assertEqual(result, answer, msg=error_output)
def test_a_instantiate_class_1(self): """[Lab 7] - [Investigation 1] - [Part 1] - Test for Creating object - should fail with string arguments""" with self.assertRaises(Exception) as context: import lab7a as lab7aStudent objtime = lab7aStudent.Time('hour', 'minute', 'second') x = lab7aStudent.format_time(objtime)
def test_a_instantiate_class_0(self): """[Lab 7] - [Investigation 1] - [Part 1] - Test for Creating object - should fail with 4 arguments""" with self.assertRaises(Exception) as context: import lab7a as lab7aStudent objtime = lab7aStudent.Time(1, 2, 3, 4)