MCPcopy Create free account
hub / github.com/PyTables/PyTables / test01

Method test01

tables/tests/test_indexvalues.py:3521–3542  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3519class SideEffectNumPyQuicksort(common.PyTablesTestCase):
3520
3521 def test01(self):
3522 bug_file = common.test_filename("bug-idx.h5")
3523 tmp_file = tempfile.mktemp(".h5")
3524 tb.copy_file(bug_file, tmp_file)
3525 h5 = tb.open_file(tmp_file, "a")
3526 o = h5.root.table
3527 vals = o.cols.path[:]
3528 npvals = set(np.where(vals == 6)[0])
3529
3530 # Setting the chunkshape is critical for reproducing the bug
3531 t = o.copy(newname="table2", chunkshape=2730)
3532 t.cols.path.create_index()
3533 indexed = {r.nrow for r in t.where("path == 6")}
3534
3535 if common.verbose:
3536 diffs = sorted(npvals - indexed)
3537 print("ndiff:", len(diffs), diffs)
3538 self.assertEqual(len(npvals), len(indexed))
3539
3540 h5.close()
3541 if Path(tmp_file).is_file():
3542 Path(tmp_file).unlink()
3543
3544
3545# -----------------------------

Callers

nothing calls this directly

Calls 5

copy_fileMethod · 0.80
whereMethod · 0.80
create_indexMethod · 0.80
copyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected