7
# from numarray import *
9
# import numarray.records as records
12
from test_all import verbose
14
# Check read Tables from pytables version 0.5 (ucl-nrv2e), and 0.7 (ucl-nvr2d)
15
class BackCompatTestCase(unittest.TestCase):
17
#----------------------------------------
19
def test01_readTable(self):
20
"""Checking backward compatibility of old formats"""
24
print "Running %s.test01_readTable..." % self.__class__.__name__
26
# Create an instance of an HDF5 Table
27
self.fileh = openFile(self.file, "r")
28
table = self.fileh.getNode("/tuple0")
30
# Read the 100 records
31
result = [ rec['var2'] for rec in table]
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)
37
assert len(result) == 100
39
class Table1_0UCL(BackCompatTestCase):
40
file = "Table1_0_ucl_nrv2e.h5" # pytables 0.5.1 and before
42
class Table2_0UCL(BackCompatTestCase):
43
file = "Table2_0_ucl_nrv2d.h5" # pytables 0.7.x versions
45
class Table2_1UCL(BackCompatTestCase):
46
file = "Table2_1_ucl_nrv2e_shuffle.h5" # pytables 0.8.x versions and after
49
#----------------------------------------------------------------------
52
theSuite = unittest.TestSuite()
55
#theSuite.addTest(unittest.makeSuite(Table1_0UCL))
56
#theSuite.addTest(unittest.makeSuite(Table2_0UCL))
57
#theSuite.addTest(unittest.makeSuite(Table2_1UCL))
59
ucl_avail = whichLibVersion("ucl")[0]
60
for n in range(niter):
62
theSuite.addTest(unittest.makeSuite(Table1_0UCL))
63
theSuite.addTest(unittest.makeSuite(Table2_0UCL))
64
theSuite.addTest(unittest.makeSuite(Table2_1UCL))
69
if __name__ == '__main__':
70
unittest.main( defaultTest='suite' )