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

« back to all changes in this revision

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

  • Committer: stevenbird
  • Date: 2008-02-20 11:50:03 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:523
Adding ReStructured Text preprocessing of exercise descriptions,
so that the markup for exercises is the same as for the tutorials.

www/apps/tutorial/rst.py
* cut down version of NLTK rst.py, which extends docutils
  with colourised python codeblocks
* modified to work with strings rather than files

www/apps/tutorial/__init__.py
* call rst() main function on exercise description once
  it is extracted from the source XML file

www/apps/tutorialservice/test/TestFramework.py
* clean up docstring

www/apps/tutorialservice/test/parse_exercise.py
* remove backwards compatibility for desc attribute
  (now authors must provide both pass and fail strings)

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    """ Create an TestCasePart instance from test part xml data
59
59
    """
60
60
    
61
 
    func_desc = partNode.getAttribute('desc')
62
61
    func_pass = partNode.getAttribute('pass')
63
62
    func_fail = partNode.getAttribute('fail')
64
 
    if not func_pass:
65
 
        func_pass = func_desc
66
 
    if not func_fail:
67
 
        func_fail = func_desc
68
63
    default = partNode.getAttribute('default')
69
64
    if default == '': default = DEFAULT_CASE_TYPE
70
65
    
101
96
    return part
102
97
 
103
98
def getCaseData(caseNode):
104
 
    """ Creare a TestCase instance from test case xml data
 
99
    """ Create a TestCase instance from test case xml data
105
100
    """
106
101
    
107
102
    case_name = caseNode.getAttribute('name')
168
163
 
169
164
    # get name
170
165
    exercise_name = exercise.getAttribute('name')
171
 
 
172
166
    if not exercise_name:
173
167
        raise ParseException('Exercise name not supplied')
174
168