return result
if __name__ == '__main__':
    tests = [('CS 2110', [[('CS', 2110)]]), ('CS 2110 and INFO 3300', [[(
        'CS', 2110), ('INFO', 3300)]]), ('CS 2110, INFO 3300', [[('CS', 
        2110), ('INFO', 3300)]]), ('CS 2110, 3300, 3140', [[('CS', 2110), (
        'CS', 3300), ('CS', 3140)]]), ('CS 2110 or INFO 3300', [[('CS', 
        2110)], [('INFO', 3300)]]), ('MATH 2210, 2230, 2310, or 2940', [[(
        'MATH', 2210), ('MATH', 2230), ('MATH', 2310)], [('MATH', 2940)]])]
for test, answer in tests:
    result = parse(test)
if result == answer:
    print('GOOD: {0} => {1}'.format(test, answer))
else:
    print('ERROR: {0} => {1} != {2}'.format(test, result, answer))
break
Python: как лучше разобрать простую грамматику?