def test_credits_invalid_type(self): """ Test that invalid type raises exception """ with self.assertRaises(Exception): CourseVal.credits("0.5") with self.assertRaises(Exception): CourseVal.credits(-0.5)
def test_credits(self): """ Test that valid args does not raise exception """ try: CourseVal.credits(0.5) except Exception: self.fail()