def test01b_readTable(self):

        if common.verbose:
            print('\n', '-=' * 30)
            print("Running %s.test01b_readTable..." % self.__class__.__name__)

        # Create an instance of an HDF5 Table
        self.h5file = tables.open_file(self.h5fname, "r")
        table = self.h5file.get_node("/table0")

        # Choose a small value for buffer size
        table.nrowsinbuf = 3
        # Read the records and select those with "var2" file less than 20
        result1 = [r['var5'] for r in table.iterrows() if r['var2'][0][0] < 20]
        if common.verbose:
            print("Nrows in", table._v_pathname, ":", table.nrows)
            print("Last record in table ==>", r)
            print("Total selected records in table ==> ", len(result1))
        nrows = table.nrows
        result2 = [r for r in table.iterrows() if r['var2'][0][0] < 20][-1]
        if isinstance(result2['var5'], np.ndarray):
            self.assertTrue(allequal(result1[0],
                                     np.array((float(0),)*4, np.float32)))
            self.assertTrue(allequal(result1[1],
                                     np.array((float(1),)*4, np.float32)))
            self.assertTrue(allequal(result1[2],
                                     np.array((float(2),)*4, np.float32)))
            self.assertTrue(allequal(result1[3],
                                     np.array((float(3),)*4, np.float32)))
            self.assertTrue(allequal(result1[10],
                                     np.array((float(10),)*4, np.float32)))
            self.assertTrue(allequal(result2['var5'],
                                     np.array((float(nrows-1),)*4,
                                              np.float32)))
        else:
            self.assertEqual(result2['var5'], float(nrows-1))
        self.assertEqual(len(result1), 20)

        # Read the records and select those with "var2" file less than 20
        result1 = [r['var1'] for r in table.iterrows() if r['var2'][0][0] < 20]
        result2 = [r for r in table.iterrows() if r['var2'][0][0] < 20][-1]

        if result2['var1'].dtype.char == "S":
            a = np.array([['%04d' % (self.expectedrows - 0)]*2]*2, 'S')
            self.assertTrue(allequal(result1[0], a))
            a = np.array([['%04d' % (self.expectedrows - 1)]*2]*2, 'S')
            self.assertTrue(allequal(result1[1], a))
            a = np.array([['%04d' % (self.expectedrows - 2)]*2]*2, 'S')
            self.assertTrue(allequal(result1[2], a))
            a = np.array([['%04d' % (self.expectedrows - 3)]*2]*2, 'S')
            self.assertTrue(allequal(result1[3], a))
            a = np.array([['%04d' % (self.expectedrows - 10)]*2]*2, 'S')
            self.assertTrue(allequal(result1[10], a))
            a = np.array([['%04d' % (1)]*2]*2, 'S')
            self.assertTrue(allequal(result2['var1'], a))
        else:
            self.assertEqual(result1['var1'], "0001")
        self.assertEqual(len(result1), 20)
Checking table read and cuts (multidimensional columns case)
dataset/ETHPy150Open PyTables/PyTables/tables/tests/test_tablesMD.py/BasicTestCase.test01b_readTable