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

« back to all changes in this revision

Viewing changes to test/test_backcompat.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 unittest
3
 
#import os
4
 
#import tempfile
5
 
 
6
 
# import numarray
7
 
# from numarray import *
8
 
# #import recarray
9
 
# import numarray.records as records
10
 
from tables import *
11
 
 
12
 
from test_all import verbose
13
 
 
14
 
# Check read Tables from pytables version 0.5 (ucl-nrv2e), and 0.7 (ucl-nvr2d)
15
 
class BackCompatTestCase(unittest.TestCase):
16
 
 
17
 
    #----------------------------------------
18
 
 
19
 
    def test01_readTable(self):
20
 
        """Checking backward compatibility of old formats"""
21
 
 
22
 
        if verbose:
23
 
            print '\n', '-=' * 30
24
 
            print "Running %s.test01_readTable..." % self.__class__.__name__
25
 
 
26
 
        # Create an instance of an HDF5 Table
27
 
        self.fileh = openFile(self.file, "r")
28
 
        table = self.fileh.getNode("/tuple0")
29
 
 
30
 
        # Read the 100 records
31
 
        result = [ rec['var2'] for rec in table]
32
 
        if verbose:
33
 
            print "Nrows in", table._v_pathname, ":", table.nrows
34
 
            print "Last record in table ==>", rec
35
 
            print "Total selected records in table ==> ", len(result)
36
 
 
37
 
        assert len(result) == 100
38
 
        
39
 
class Table1_0UCL(BackCompatTestCase):
40
 
    file = "Table1_0_ucl_nrv2e.h5"  # pytables 0.5.1 and before
41
 
 
42
 
class Table2_0UCL(BackCompatTestCase):
43
 
    file = "Table2_0_ucl_nrv2d.h5"  # pytables 0.7.x versions
44
 
 
45
 
class Table2_1UCL(BackCompatTestCase):
46
 
    file = "Table2_1_ucl_nrv2e_shuffle.h5"  # pytables 0.8.x versions and after
47
 
 
48
 
 
49
 
#----------------------------------------------------------------------
50
 
 
51
 
def suite():
52
 
    theSuite = unittest.TestSuite()
53
 
    niter = 1
54
 
 
55
 
    #theSuite.addTest(unittest.makeSuite(Table1_0UCL))
56
 
    #theSuite.addTest(unittest.makeSuite(Table2_0UCL))
57
 
    #theSuite.addTest(unittest.makeSuite(Table2_1UCL))
58
 
 
59
 
    ucl_avail = whichLibVersion("ucl")[0]
60
 
    for n in range(niter):
61
 
        if ucl_avail:
62
 
            theSuite.addTest(unittest.makeSuite(Table1_0UCL))
63
 
            theSuite.addTest(unittest.makeSuite(Table2_0UCL))
64
 
            theSuite.addTest(unittest.makeSuite(Table2_1UCL))
65
 
            
66
 
    return theSuite
67
 
 
68
 
 
69
 
if __name__ == '__main__':
70
 
    unittest.main( defaultTest='suite' )