diff --git a/pretext/UnitTesting/WritingUnitTests.ptx b/pretext/UnitTesting/WritingUnitTests.ptx index fc03ac76..10e92aa6 100644 --- a/pretext/UnitTesting/WritingUnitTests.ptx +++ b/pretext/UnitTesting/WritingUnitTests.ptx @@ -163,28 +163,29 @@ assert grade(85) == 'B' assert grade(69) == 'F' - - - - - - - - - - - - - - - - - - - - - - + + ac_grade_unittest_aux_reveal + instructoronly + actex:: ac_grade_unittest_aux + testA = False + testB = False + testF = False + illegal = False + def grade(score): + global illegal, testA, testB, testF + if score > 100 or score < 0: + illegal = True + return '' + elif score >= 90: + testA = True + return 'A' + elif score >= 80: + testB = True + return 'B' + else: + testF = True + return 'F' +