~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-18 09:11:10 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:495
Fixes to permit content authors to produce nicer diagnostic responses as a result
of automatic tests on a submitted exercise: the XML "problem" format is extended
to permit two new attributes on the function element: succeed and fail, each providing
the text string to be used depending on the result of the test. 

/www/apps/tutorialservice/test/TestFramework.py:TestCasePart
* made ident et al into classmethods (fixing a commented complaint that
  these receive self as first argument)
* replaced redundant lambda functions with references to these class methods
* running a test case now puts the succeed vs fail string in the description
  depending on the result

/www/apps/tutorialservice/test/parse_tute.py:getCasePartData()
* added support for two new attributes on function elements: succeed, fail
* default value comes from existing attribute desc for backwards compatibility

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    """
59
59
    
60
60
    func_desc = partNode.getAttribute('desc')
 
61
    func_succeed = partNode.getAttribute('succeed')
 
62
    func_fail = partNode.getAttribute('fail')
 
63
    if not func_succeed:
 
64
        func_succeed = func_desc
 
65
    if not func_fail:
 
66
        func_fail = func_desc
61
67
    default = partNode.getAttribute('default')
62
68
    if default == '': default = DEFAULT_CASE_TYPE
63
69
    
64
 
    part = TestCasePart(func_desc, default)
 
70
    part = TestCasePart(func_succeed, func_fail, default)
65
71
 
66
72
    for child in partNode.childNodes:
67
73
        if child.nodeType != child.ELEMENT_NODE: