class Student(object): def __init__(self, name, score): self.name = name self.score = score def get_grade(self): if self.score > 100 or self.score < 0: raise ValueError if self.score >= 80: return 'A' if self.score >= 60: return 'B' return 'C'
不过感觉这一节的精髓在编写测试类,而不是测试对象
Sign in to make a reply
南小i
不过感觉这一节的精髓在编写测试类,而不是测试对象