~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/tutorialservice/test/parse_tute.py

  • Committer: stevenbird
  • Date: 2008-02-19 03:59:20 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:502
www/apps/tutorialservice/__init__.py
* changed name from "Problem" to "Exercise"

www/apps/tutorialservice/test/parse_tute.py,TestFramework.py
* changed "succeed" to "pass" for consistency
* added code_test functionality to TestCasePart
* added check_code to run normalisations and comparisons
  on code instead of output
* extended solution_data and attempt_data dictionaries to
  include the code
* still broken with an error on line 423 of TestFramework.py
  (the function supplied in the XML file for testing the code
  can't be called?)

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    return data.strip()
55
55
 
56
56
def getCasePartData(partNode):
57
 
    """ Create an TestCasePaart instance from test part xml data
 
57
    """ Create an TestCasePart instance from test part xml data
58
58
    """
59
59
    
60
60
    func_desc = partNode.getAttribute('desc')
61
 
    func_succeed = partNode.getAttribute('succeed')
 
61
    func_pass = partNode.getAttribute('pass')
62
62
    func_fail = partNode.getAttribute('fail')
63
 
    if not func_succeed:
64
 
        func_succeed = func_desc
 
63
    if not func_pass:
 
64
        func_pass = func_desc
65
65
    if not func_fail:
66
66
        func_fail = func_desc
67
67
    default = partNode.getAttribute('default')
68
68
    if default == '': default = DEFAULT_CASE_TYPE
69
69
    
70
 
    part = TestCasePart(func_succeed, func_fail, default)
 
70
    part = TestCasePart(func_pass, func_fail, default)
71
71
 
72
72
    for child in partNode.childNodes:
73
73
        if child.nodeType != child.ELEMENT_NODE:
92
92
            if filename == '':
93
93
                raise ParseException("File without name in case %s" %case_name)
94
94
            part.add_file_test(filename, getTextData(child), test_type)
 
95
        elif child.tagName == 'code':
 
96
            test_type = child.getAttribute('type')
 
97
            if test_type == '': test_type = DEFAULT_TEST_TYPE
 
98
            part.add_code_test(getTextData(child), test_type)
95
99
 
96
100
    return part
97
101