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

Method test01a_EmptyVLArray

tables/tests/test_vlarray.py:2357–2385  ·  view source on GitHub ↗

Checking empty vlarrays with different flavors (closing the file)

(self)

Source from the content-addressed store, hash-verified

2355 self.rootgroup = self.h5file.root
2356
2357 def test01a_EmptyVLArray(self):
2358 """Checking empty vlarrays with different flavors (closing the file)"""
2359
2360 root = self.rootgroup
2361 if common.verbose:
2362 print("\n", "-=" * 30)
2363 print(
2364 "Running %s.test01_EmptyVLArray..." % self.__class__.__name__
2365 )
2366
2367 # Create an string atom
2368 vlarray = self.h5file.create_vlarray(
2369 root, "vlarray", tb.Atom.from_kind("int", itemsize=4)
2370 )
2371 vlarray.flavor = self.flavor
2372 self.h5file.close()
2373 self.h5file = tb.open_file(self.h5fname, "r")
2374
2375 # Read all the rows (it should be empty):
2376 vlarray = self.h5file.root.vlarray
2377 row = vlarray.read()
2378 if common.verbose:
2379 print("Testing flavor:", self.flavor)
2380 print("Object read:", row, repr(row))
2381 print("Nrows in", vlarray._v_pathname, ":", vlarray.nrows)
2382
2383 # Check that the object read is effectively empty
2384 self.assertEqual(vlarray.nrows, 0)
2385 self.assertEqual(row, [])
2386
2387 def test01b_EmptyVLArray(self):
2388 """Checking empty vlarrays with different flavors (no closing file)"""

Callers

nothing calls this directly

Calls 4

create_vlarrayMethod · 0.80
from_kindMethod · 0.45
closeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected