def test_get_program_length(self): school = School(school_id='123456', degrees_highest='2') program = Program(institution=school, level='2') test1 = get_program_length(program=program, school=school) self.assertTrue(test1 == 2) test2 = get_program_length(program='', school=school) self.assertTrue(test2 == 2) test3 = get_program_length(program='', school='') self.assertTrue(test3 is None) program.level = '3' test4 = get_program_length(program=program, school='') self.assertTrue(test4 == 4)
def test_get_program_length(self): school = School(school_id=123456, degrees_highest='2') program = Program(institution=school, level='2') bad_school = School(school_id=999999, degrees_highest='5') test1 = get_program_length(program=program, school=school) self.assertTrue(test1 == 2) test2 = get_program_length(program='', school=school) self.assertTrue(test2 == 2) test3 = get_program_length(program='', school='') self.assertIs(test3, None) program.level = '3' test4 = get_program_length(program=program, school='') self.assertEqual(test4, 4) bad_school_test = get_program_length(program='', school=bad_school) self.assertIs(bad_school_test, None)