Checking table read (using Row[integer])
(self)
| 494 | self.assertEqual(len(result), 20) |
| 495 | |
| 496 | def test01a_integer(self): |
| 497 | """Checking table read (using Row[integer])""" |
| 498 | |
| 499 | if common.verbose: |
| 500 | print("\n", "-=" * 30) |
| 501 | print("Running %s.test01a_integer..." % self.__class__.__name__) |
| 502 | |
| 503 | # Create an instance of an HDF5 Table |
| 504 | self.h5file = tb.open_file(self.h5fname, "r") |
| 505 | table = self.h5file.get_node("/table0") |
| 506 | |
| 507 | # Choose a small value for buffer size |
| 508 | table.nrowsinbuf = 3 |
| 509 | # Read the records and select those with "var2" file less than 20 |
| 510 | result = [rec[1] for rec in table.iterrows() if rec["var2"] < 20] |
| 511 | if common.verbose: |
| 512 | print("Nrows in", table._v_pathname, ":", table.nrows) |
| 513 | print("Total selected records in table ==> ", len(result)) |
| 514 | print("All results ==>", result) |
| 515 | self.assertEqual(len(result), 20) |
| 516 | self.assertEqual(result, list(range(20))) |
| 517 | |
| 518 | def test01a_extslice(self): |
| 519 | """Checking table read (using Row[::2])""" |