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

« back to all changes in this revision

Viewing changes to www/apps/tutorial/test/TestFramework.py

  • Committer: dilshan_a
  • Date: 2008-01-24 04:52:56 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:283
Fixed a bug where variables were persistent across test cases.

Added initial minutes/report/documentation on tutorials.

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
    """
237
237
    A set of tests with a common inputs
238
238
    """
239
 
    def __init__(self, name='', function=None, stdin='', filespace={}, global_space={}):
 
239
    def __init__(self, name='', function=None, stdin='', filespace=None, global_space=None):
240
240
        """Initialise with name and optionally, a function to test (instead of the entire script)
241
241
        The inputs stdin, the filespace and global variables can also be specified at
242
242
        initialisation, but may also be set later.
243
243
        """
 
244
        if global_space == None:
 
245
            global_space = {}
 
246
        if filespace == None:
 
247
            filespace = {}
 
248
        
244
249
        self._name = name
245
250
        
246
251
        if function == '': function = None
269
274
        for this test case.
270
275
        Throw and exception if thevalue cannot be paresed.
271
276
        """
 
277
        
272
278
        try:
273
279
            self._global_space[variable] = eval(value)
274
280
        except:
467
473
    Our dummy file system which is accessed by code being tested.
468
474
    Implemented as a dictionary which maps filenames to strings
469
475
    """
470
 
    def __init__(self, files={}):
 
476
    def __init__(self, files=None):
471
477
        "Initialise, optionally with filename-filedata pairs"
472
478
 
 
479
        if files == None:
 
480
            files = {}
 
481
 
473
482
        # dict mapping files to strings
474
483
        self._files = {}
475
484
        self._files.update(files)