~ubuntu-branches/ubuntu/natty/pytables/natty-updates

« back to all changes in this revision

Viewing changes to test/test_tree.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2006-06-28 10:45:03 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060628104503-cc251q5o5j3e2k10
  * Fixed call to pyversions in debian/rules which failed on recent versions 
    of pyversions
  * Fixed clean rule in debian/rules which left the stamp files behind
  * Acknowledge NMU
  * Added Alexandre Fayolle to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import sys
2
 
import warnings
3
 
import unittest
4
 
import os
5
 
import tempfile
6
 
 
7
 
from tables import *
8
 
# Next imports are only necessary for this test suite
9
 
from tables import Group, Leaf, Table, Array
10
 
 
11
 
from test_all import verbose, heavy
12
 
 
13
 
#heavy = 1  # Uncomment this only for test purposes!
14
 
 
15
 
# Test Record class
16
 
class Record(IsDescription):
17
 
    var1 = StringCol(length=4)    # 4-character String
18
 
    var2 = IntCol()               # integer
19
 
    var3 = Int16Col()             # short integer
20
 
    var4 = FloatCol()             # double (double-precision)
21
 
    var5 = Float32Col()           # float  (single-precision)
22
 
 
23
 
class TreeTestCase(unittest.TestCase):
24
 
    mode  = "w" 
25
 
    title = "This is the table title"
26
 
    expectedrows = 10
27
 
    appendrows = 5
28
 
 
29
 
    def setUp(self):
30
 
        # Create a temporary file
31
 
        self.file = tempfile.mktemp(".h5")
32
 
        # Create an instance of HDF5 Table
33
 
        self.h5file = openFile(self.file, self.mode, self.title)
34
 
        self.populateFile()
35
 
        self.h5file.close()
36
 
            
37
 
    def populateFile(self):
38
 
        group = self.h5file.root
39
 
        maxshort = 1 << 15
40
 
        maxint   = 2147483647   # (2 ** 31 - 1)
41
 
        for j in range(3):
42
 
            # Create a table
43
 
            table = self.h5file.createTable(group, 'table'+str(j), Record,
44
 
                                        title = self.title,
45
 
                                        filters = None,
46
 
                                        expectedrows = self.expectedrows)
47
 
            # Get the record object associated with the new table
48
 
            d = table.row 
49
 
            # Fill the table
50
 
            for i in xrange(self.expectedrows):
51
 
                d['var1'] = '%04d' % (self.expectedrows - i)
52
 
                d['var2'] = i 
53
 
                d['var3'] = i % maxshort
54
 
                d['var4'] = float(i)
55
 
                d['var5'] = float(i)
56
 
                d.append()      # This injects the Record values
57
 
            # Flush the buffer for this table
58
 
            table.flush()
59
 
            
60
 
            # Create a couple of arrays in each group
61
 
            var1List = [ x['var1'] for x in table.iterrows() ]
62
 
            var4List = [ x['var4'] for x in table.iterrows() ]
63
 
 
64
 
            self.h5file.createArray(group, 'var1', var1List, "1")
65
 
            self.h5file.createArray(group, 'var4', var4List, "4")
66
 
            
67
 
            # Create a new group (descendant of group)
68
 
            group2 = self.h5file.createGroup(group, 'group'+str(j))
69
 
            # Iterate over this new group (group2)
70
 
            group = group2
71
 
    
72
 
    def tearDown(self):
73
 
        # Close the file
74
 
        if self.h5file.isopen:
75
 
            self.h5file.close()
76
 
 
77
 
        os.remove(self.file)
78
 
 
79
 
    #----------------------------------------
80
 
 
81
 
    def test00_getNode(self):
82
 
        "Checking the File.getNode() with string node names"
83
 
        
84
 
        if verbose:
85
 
            print '\n', '-=' * 30
86
 
            print "Running %s.test00_getNode..." % self.__class__.__name__
87
 
 
88
 
        self.h5file = openFile(self.file, "r")
89
 
        nodelist = ['/', '/table0', '/group0/var1', '/group0/group1/var4']
90
 
        nodenames = []
91
 
        for node in nodelist:
92
 
            object = self.h5file.getNode(node)
93
 
            nodenames.append(object._v_pathname)
94
 
 
95
 
        assert nodenames == nodelist
96
 
        
97
 
        if verbose:
98
 
            print "getNode(pathname) test passed"
99
 
            
100
 
        nodegroups = ['/', '/group0', '/group0/group1', '/group0/group1/group2']
101
 
        nodenames = ['var1', 'var4']
102
 
        nodepaths = []
103
 
        for group in nodegroups:
104
 
            for name in nodenames:
105
 
                try:
106
 
                    object = self.h5file.getNode(group, name)
107
 
                except LookupError:
108
 
                    pass
109
 
                else:
110
 
                    nodepaths.append(object._v_pathname)
111
 
 
112
 
        assert nodepaths == ['/var1', '/var4',
113
 
                             '/group0/var1', '/group0/var4',
114
 
                             '/group0/group1/var1', '/group0/group1/var4',
115
 
                             ]
116
 
 
117
 
        if verbose:
118
 
            print "getNode(groupname, name) test passed"
119
 
            
120
 
        
121
 
        nodelist = ['/', '/group0', '/group0/group1', '/group0/group1/group2',
122
 
                    '/table0']
123
 
        nodenames = []
124
 
        groupobjects = []
125
 
        #warnings.filterwarnings("error", category=UserWarning)
126
 
        for node in nodelist:
127
 
            try:
128
 
                object = self.h5file.getNode(node, classname = 'Group')
129
 
            except LookupError:
130
 
                if verbose:
131
 
                    (type, value, traceback) = sys.exc_info()
132
 
                    print "\nGreat!, the next LookupError was catched!"
133
 
                    print value
134
 
            else:
135
 
                nodenames.append(object._v_pathname)
136
 
                groupobjects.append(object)
137
 
 
138
 
        assert nodenames == ['/', '/group0', '/group0/group1',
139
 
                             '/group0/group1/group2',
140
 
                             ]
141
 
        
142
 
        if verbose:
143
 
            print "getNode(groupname, classname='Group') test passed"
144
 
 
145
 
        # Reset the warning
146
 
        #warnings.filterwarnings("default", category=UserWarning)
147
 
 
148
 
        nodenames = ['var1', 'var4']
149
 
        nodearrays = []
150
 
        for group in groupobjects:
151
 
            for name in nodenames:
152
 
                try:
153
 
                    object = self.h5file.getNode(group, name, 'Array')
154
 
                except:
155
 
                    pass
156
 
                else:
157
 
                    nodearrays.append(object._v_pathname)
158
 
 
159
 
        assert nodearrays == ['/var1', '/var4',
160
 
                             '/group0/var1', '/group0/var4',
161
 
                             '/group0/group1/var1', '/group0/group1/var4',
162
 
                             ]
163
 
        
164
 
        if verbose:
165
 
            print "getNode(groupobject, name, classname='Array') test passed"
166
 
 
167
 
            
168
 
    def test01_getNodeClass(self):
169
 
        "Checking the File.getNode() with instances"
170
 
 
171
 
        if verbose:
172
 
            print '\n', '-=' * 30
173
 
            print "Running %s.test01_getNodeClass..." % self.__class__.__name__
174
 
 
175
 
        self.h5file = openFile(self.file, "r")
176
 
        # This tree ways of getNode usage should return a table instance
177
 
        table = self.h5file.getNode("/group0/table1")
178
 
        assert isinstance(table, Table)
179
 
        table = self.h5file.getNode("/group0", "table1")
180
 
        assert isinstance(table, Table)
181
 
        table = self.h5file.getNode(self.h5file.root.group0, "table1")
182
 
        assert isinstance(table, Table)
183
 
        
184
 
        # This should return an array instance
185
 
        arr = self.h5file.getNode("/group0/var1")
186
 
        assert isinstance(arr, Array)
187
 
        assert isinstance(arr, Leaf)
188
 
        
189
 
        # And this a Group
190
 
        group = self.h5file.getNode("/group0", "group1", "Group")
191
 
        assert isinstance(group, Group)
192
 
 
193
 
        
194
 
    def test02_listNodes(self):
195
 
        "Checking the File.listNodes() method"
196
 
 
197
 
        if verbose:
198
 
            print '\n', '-=' * 30
199
 
            print "Running %s.test02_listNodes..." % self.__class__.__name__
200
 
 
201
 
        # Made the warnings to raise an error
202
 
        #warnings.filterwarnings("error", category=UserWarning)
203
 
        self.h5file = openFile(self.file, "r")
204
 
        nodelist = ['/', '/group0', '/group0/table1', '/group0/group1/group2',
205
 
                    '/var1']
206
 
        nodenames = []
207
 
        objects = []
208
 
        for node in nodelist:
209
 
            try:
210
 
                objectlist = self.h5file.listNodes(node)
211
 
            except:
212
 
                pass
213
 
            else:
214
 
                objects.extend(objectlist)
215
 
                for object in objectlist:
216
 
                    nodenames.append(object._v_pathname)
217
 
 
218
 
        assert nodenames == ['/group0', '/table0', '/var1', '/var4',
219
 
                             '/group0/group1', '/group0/table1',
220
 
                             '/group0/var1', '/group0/var4',
221
 
                             ]
222
 
        
223
 
        if verbose:
224
 
            print "listNodes(pathname) test passed"
225
 
 
226
 
        nodenames = []
227
 
        for node in objects:
228
 
            try:
229
 
                objectlist = self.h5file.listNodes(node)
230
 
            except:
231
 
                pass
232
 
            else:
233
 
                for object in objectlist:
234
 
                    nodenames.append(object._v_pathname)
235
 
 
236
 
        assert nodenames == ['/group0/group1', '/group0/table1', 
237
 
                             '/group0/var1', '/group0/var4',
238
 
                             '/group0/group1/group2', '/group0/group1/table2',
239
 
                             '/group0/group1/var1', '/group0/group1/var4',
240
 
                             ]
241
 
        
242
 
        if verbose:
243
 
            print "listNodes(groupobject) test passed"
244
 
 
245
 
        nodenames = []
246
 
        for node in objects:
247
 
            try:
248
 
                objectlist = self.h5file.listNodes(node, 'Leaf')
249
 
            except LookupError:
250
 
                if verbose:
251
 
                    (type, value, traceback) = sys.exc_info()
252
 
                    print "\nGreat!, the next LookupError was catched!"
253
 
                    print value
254
 
            else:
255
 
                for object in objectlist:
256
 
                    nodenames.append(object._v_pathname)
257
 
 
258
 
        assert nodenames == ['/group0/table1', 
259
 
                             '/group0/var1', '/group0/var4',
260
 
                             '/group0/group1/table2',
261
 
                             '/group0/group1/var1', '/group0/group1/var4',
262
 
                             ]
263
 
        
264
 
        if verbose:
265
 
            print "listNodes(groupobject, classname = 'Leaf') test passed"
266
 
 
267
 
        nodenames = []
268
 
        for node in objects:
269
 
            try:
270
 
                objectlist = self.h5file.listNodes(node, 'Table')
271
 
            except LookupError:
272
 
                if verbose:
273
 
                    (type, value, traceback) = sys.exc_info()
274
 
                    print "\nGreat!, the next LookupError was catched!"
275
 
                    print value
276
 
            else:
277
 
                for object in objectlist:
278
 
                    nodenames.append(object._v_pathname)
279
 
 
280
 
        assert nodenames == ['/group0/table1', 
281
 
                             '/group0/group1/table2',
282
 
                             ]
283
 
        
284
 
        if verbose:
285
 
            print "listNodes(groupobject, classname = 'Table') test passed"
286
 
 
287
 
        # Reset the warning
288
 
        #warnings.filterwarnings("default", category=UserWarning)
289
 
            
290
 
    def test03_TraverseTree(self):
291
 
        "Checking the File.walkGroups() method"
292
 
        
293
 
        if verbose:
294
 
            print '\n', '-=' * 30
295
 
            print "Running %s.test03_TraverseTree..." % self.__class__.__name__
296
 
 
297
 
        self.h5file = openFile(self.file, "r")
298
 
        groups = []
299
 
        tables = []
300
 
        arrays = []
301
 
        for group in self.h5file.walkGroups():
302
 
            groups.append(group._v_pathname)
303
 
            for table in self.h5file.listNodes(group, 'Table'):
304
 
                tables.append(table._v_pathname)
305
 
            for arr in self.h5file.listNodes(group, 'Array'):
306
 
                arrays.append(arr._v_pathname)
307
 
 
308
 
        assert groups == ["/", "/group0", "/group0/group1",
309
 
                          "/group0/group1/group2"]
310
 
                          
311
 
        assert tables == ["/table0", "/group0/table1", "/group0/group1/table2"]
312
 
 
313
 
        assert arrays == ['/var1', '/var4',
314
 
                          '/group0/var1', '/group0/var4',
315
 
                          '/group0/group1/var1', '/group0/group1/var4']
316
 
                          
317
 
        if verbose:
318
 
            print "walkGroups() test passed"
319
 
 
320
 
        groups = []
321
 
        tables = []
322
 
        arrays = []
323
 
        for group in self.h5file.walkGroups("/group0/group1"):
324
 
            groups.append(group._v_pathname)
325
 
            for table in self.h5file.listNodes(group, 'Table'):
326
 
                tables.append(table._v_pathname)
327
 
            for arr in self.h5file.listNodes(group, 'Array'):
328
 
                arrays.append(arr._v_pathname)
329
 
 
330
 
        assert groups == ["/group0/group1",
331
 
                          "/group0/group1/group2"]
332
 
                          
333
 
        assert tables == ["/group0/group1/table2"]
334
 
 
335
 
        assert arrays == ['/group0/group1/var1', '/group0/group1/var4']
336
 
        
337
 
        if verbose:
338
 
            print "walkGroups(pathname) test passed"
339
 
 
340
 
    def test04_walkNodes(self):
341
 
        "Checking File.walkNodes"
342
 
        
343
 
        if verbose:
344
 
            print '\n', '-=' * 30
345
 
            print "Running %s.test04_walkNodes..." % self.__class__.__name__
346
 
 
347
 
        self.h5file = openFile(self.file, "r")
348
 
        groups = []
349
 
        tables = []
350
 
        tables2 = []
351
 
        arrays = []
352
 
        for group in self.h5file.walkNodes(classname="Group"):
353
 
            groups.append(group._v_pathname)
354
 
            for table in group._f_walkNodes(classname='Table'):
355
 
                tables.append(table._v_pathname)
356
 
                
357
 
        # Test the recursivity    
358
 
        for table in self.h5file.root._f_walkNodes('Table', recursive=1):
359
 
            tables2.append(table._v_pathname)
360
 
 
361
 
        for arr in self.h5file.walkNodes(classname='Array'):
362
 
            arrays.append(arr._v_pathname)
363
 
 
364
 
        assert groups == ["/", "/group0", "/group0/group1",
365
 
                          "/group0/group1/group2"]
366
 
        assert tables == ["/table0", "/group0/table1",
367
 
                          "/group0/group1/table2"]
368
 
        assert tables2 == ["/table0", "/group0/table1",
369
 
                           "/group0/group1/table2"]
370
 
        assert arrays == ['/var1', '/var4',
371
 
                          '/group0/var1', '/group0/var4',
372
 
                          '/group0/group1/var1', '/group0/group1/var4']
373
 
                          
374
 
        if verbose:
375
 
            print "File.__iter__() and Group.__iter__ test passed"
376
 
 
377
 
        groups = []
378
 
        tables = []
379
 
        arrays = []
380
 
        for group in self.h5file.walkNodes("/group0/group1", classname="Group"):
381
 
            groups.append(group._v_pathname)
382
 
            for table in group._f_walkNodes('Table'):
383
 
                tables.append(table._v_pathname)
384
 
            for arr in self.h5file.walkNodes(group, 'Array'):
385
 
                arrays.append(arr._v_pathname)
386
 
 
387
 
        assert groups == ["/group0/group1",
388
 
                          "/group0/group1/group2"]
389
 
                          
390
 
        assert tables == ["/group0/group1/table2"]
391
 
 
392
 
        assert arrays == ['/group0/group1/var1', '/group0/group1/var4']
393
 
        
394
 
        if verbose:
395
 
            print "walkNodes(pathname, classname) test passed"
396
 
 
397
 
 
398
 
class DeepTreeTestCase(unittest.TestCase):
399
 
    """Checks for maximum deepest level in PyTables trees.
400
 
    
401
 
    Right now, the maximum depth for object tree is determined by the
402
 
    maximum recursion level offered by Python (which for my platform
403
 
    is a number between 768 and 1024).
404
 
    
405
 
    """
406
 
    def test00_deepTree(self):
407
 
        "Checking creation of large depth object tree Variable"
408
 
        
409
 
        # Here we put a more conservative limit to deal with more platforms
410
 
        # With maxdepth = 512 this test would take less than 20 MB
411
 
        # of main memory to run, which is quite reasonable nowadays.
412
 
        # With maxdepth = 1024 this test will take over 40 MB.
413
 
        if heavy:
414
 
            maxdepth = 1024  # Only for big machines!
415
 
        else:
416
 
            maxdepth = 256  # This should be safe for most machines
417
 
        
418
 
        if verbose:
419
 
            print '\n', '-=' * 30
420
 
            print "Running %s.test00_deepTree..." % \
421
 
                  self.__class__.__name__
422
 
            print "Maximum depth tested :", maxdepth
423
 
                  
424
 
        # Open a new empty HDF5 file
425
 
        file = tempfile.mktemp(".h5")
426
 
        #file = "deep.h5"
427
 
        fileh = openFile(file, mode = "w")
428
 
        #group = fileh.root
429
 
        pathname = "/"
430
 
        if verbose:
431
 
            print "Depth writing progress: ",
432
 
        # Iterate until maxdepth
433
 
        for depth in range(maxdepth):
434
 
            # Save it on the HDF5 file
435
 
            if verbose:
436
 
                print "%3d," % (depth),
437
 
            a = [1, 1]
438
 
            #fileh.createArray(group, 'array', a, "depth: %d" % depth)
439
 
            fileh.createArray(pathname, 'array', a, "depth: %d" % depth)
440
 
            #group = fileh.createGroup(group, 'group' + str(depth))
441
 
            group = fileh.createGroup(pathname, 'group' + str(depth))
442
 
            pathname = group._v_pathname
443
 
        # Close the file
444
 
        fileh.close()
445
 
        
446
 
        # Open the previous HDF5 file in read-only mode
447
 
        fileh = openFile(file, mode = "r")
448
 
        group = fileh.root
449
 
        pathname = "/"
450
 
        if verbose:
451
 
            print "\nDepth reading progress: ",
452
 
        # Get the metadata on the previosly saved arrays
453
 
        for depth in range(maxdepth):
454
 
            if verbose:
455
 
                print "%3d," % (depth),
456
 
            # Create an array for later comparison
457
 
            a = [1, 1]
458
 
            # Get the actual array
459
 
            b = group.array.read()
460
 
            # Arrays a and b must be equal
461
 
            assert a == b
462
 
            # Iterate over the next group
463
 
            group = fileh.getNode(pathname, 'group' + str(depth))
464
 
            #group = fileh.getNode(group, 'group' + str(depth))
465
 
            pathname = group._v_pathname
466
 
        if verbose:
467
 
            print # This flush the stdout buffer
468
 
        # Close the file
469
 
        fileh.close()
470
 
        
471
 
        # Then, delete the file
472
 
        os.remove(file)
473
 
        
474
 
class WideTreeTestCase(unittest.TestCase):
475
 
    """Checks for maximum number of children for a Group.
476
 
    
477
 
    
478
 
    """
479
 
    def test00_Leafs(self):
480
 
        """Checking creation of large number of leafs (1024) per group 
481
 
        
482
 
        Variable 'maxchildren' controls this check. PyTables support
483
 
        up to 4096 children per group, but this would take too much
484
 
        memory (up to 64 MB) for testing purposes (may be we can add a
485
 
        test for big platforms). A 1024 children run takes up to 30 MB.
486
 
        A 512 children test takes around 25 MB.
487
 
        
488
 
        """
489
 
 
490
 
        import time
491
 
        if heavy:
492
 
            maxchildren = 4096
493
 
        else:
494
 
            maxchildren = 256            
495
 
        if verbose:
496
 
            print '\n', '-=' * 30
497
 
            print "Running %s.test00_wideTree..." % \
498
 
                  self.__class__.__name__
499
 
            print "Maximum number of children tested :", maxchildren
500
 
        # Open a new empty HDF5 file
501
 
        file = tempfile.mktemp(".h5")
502
 
        #file = "test_widetree.h5"
503
 
 
504
 
        a = [1, 1]
505
 
        fileh = openFile(file, mode = "w")
506
 
        if verbose:
507
 
            print "Children writing progress: ",
508
 
        for child in range(maxchildren):
509
 
            if verbose:
510
 
                print "%3d," % (child),
511
 
            fileh.createArray(fileh.root, 'array' + str(child),
512
 
                              a, "child: %d" % child)
513
 
        if verbose:
514
 
            print
515
 
        # Close the file
516
 
        fileh.close()
517
 
 
518
 
        t1 = time.time()
519
 
        a = [1, 1]
520
 
        # Open the previous HDF5 file in read-only mode
521
 
        fileh = openFile(file, mode = "r")
522
 
        if verbose:
523
 
            print "\nTime spent opening a file with %d arrays: %s s" % \
524
 
                  (maxchildren, time.time()-t1)
525
 
            print "\nChildren reading progress: ",
526
 
        # Get the metadata on the previosly saved arrays
527
 
        for child in range(maxchildren):
528
 
            if verbose:
529
 
                print "%3d," % (child),
530
 
            # Create an array for later comparison
531
 
            # Get the actual array
532
 
            array_ = getattr(fileh.root, 'array' + str(child))
533
 
            b = array_.read()
534
 
            # Arrays a and b must be equal
535
 
            assert a == b
536
 
        if verbose:
537
 
            print # This flush the stdout buffer
538
 
        # Close the file
539
 
        fileh.close()
540
 
        # Then, delete the file
541
 
        os.remove(file)
542
 
        
543
 
    def test01_wideTree(self):
544
 
        """Checking creation of large number of groups (1024) per group 
545
 
        
546
 
        Variable 'maxchildren' controls this check. PyTables support
547
 
        up to 4096 children per group, but this would take too much
548
 
        memory (up to 64 MB) for testing purposes (may be we can add a
549
 
        test for big platforms). A 1024 children run takes up to 30 MB.
550
 
        A 512 children test takes around 25 MB.
551
 
        
552
 
        """
553
 
 
554
 
        import time
555
 
        if heavy:
556
 
            # for big platforms!
557
 
            maxchildren = 4096
558
 
        else:
559
 
            # for standard platforms
560
 
            maxchildren = 256
561
 
        if verbose:
562
 
            print '\n', '-=' * 30
563
 
            print "Running %s.test00_wideTree..." % \
564
 
                  self.__class__.__name__
565
 
            print "Maximum number of children tested :", maxchildren
566
 
        # Open a new empty HDF5 file
567
 
        file = tempfile.mktemp(".h5")
568
 
        #file = "test_widetree.h5"
569
 
 
570
 
        fileh = openFile(file, mode = "w")
571
 
        if verbose:
572
 
            print "Children writing progress: ",
573
 
        for child in range(maxchildren):
574
 
            if verbose:
575
 
                print "%3d," % (child),
576
 
            fileh.createGroup(fileh.root, 'group' + str(child),
577
 
                              "child: %d" % child)
578
 
        if verbose:
579
 
            print
580
 
        # Close the file
581
 
        fileh.close()
582
 
 
583
 
        t1 = time.time()
584
 
        # Open the previous HDF5 file in read-only mode
585
 
        fileh = openFile(file, mode = "r")
586
 
        if verbose:
587
 
            print "\nTime spent opening a file with %d groups: %s s" % \
588
 
                  (maxchildren, time.time()-t1)
589
 
            print "\nChildren reading progress: ",
590
 
        # Get the metadata on the previosly saved arrays
591
 
        for child in range(maxchildren):
592
 
            if verbose:
593
 
                print "%3d," % (child),
594
 
            # Get the actual group
595
 
            group = getattr(fileh.root, 'group' + str(child))
596
 
            # Arrays a and b must be equal
597
 
            assert group._v_title == "child: %d" % child
598
 
        if verbose:
599
 
            print # This flush the stdout buffer
600
 
        # Close the file
601
 
        fileh.close()
602
 
        # Then, delete the file
603
 
        os.remove(file)
604
 
        
605
 
#----------------------------------------------------------------------
606
 
 
607
 
def suite():
608
 
    theSuite = unittest.TestSuite()
609
 
    # This counter is useful when detecting memory leaks
610
 
    niter = 1
611
 
    #heavy=1  # see at the beginning
612
 
 
613
 
    #theSuite.addTest(unittest.makeSuite(DeepTreeTestCase))
614
 
    
615
 
    for i in range(niter):
616
 
        theSuite.addTest(unittest.makeSuite(TreeTestCase))
617
 
        theSuite.addTest(unittest.makeSuite(DeepTreeTestCase))
618
 
        theSuite.addTest(unittest.makeSuite(WideTreeTestCase))
619
 
 
620
 
    return theSuite
621
 
 
622
 
 
623
 
if __name__ == '__main__':
624
 
    unittest.main( defaultTest='suite' )