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

Method populateFile

tables/tests/test_vlarray.py:29–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 self.h5file.close()
28
29 def populateFile(self):
30 group = self.rootgroup
31 filters = tb.Filters(
32 complevel=self.compress,
33 complib=self.complib,
34 shuffle=self.shuffle,
35 bitshuffle=self.bitshuffle,
36 fletcher32=self.fletcher32,
37 )
38 vlarray = self.h5file.create_vlarray(
39 group,
40 "vlarray1",
41 atom=tb.Int32Atom(),
42 title="ragged array of ints",
43 filters=filters,
44 expectedrows=1000,
45 )
46 vlarray.flavor = self.flavor
47
48 # Fill it with 5 rows
49 vlarray.append([1, 2])
50 if self.flavor == "numpy":
51 vlarray.append(np.array([3, 4, 5], dtype="int32"))
52 vlarray.append(np.array([], dtype="int32")) # Empty entry
53 elif self.flavor == "python":
54 vlarray.append((3, 4, 5))
55 vlarray.append(()) # Empty entry
56 vlarray.append([6, 7, 8, 9])
57 vlarray.append([10, 11, 12, 13, 14])
58
59 def test00_attributes(self):
60 self.h5file = tb.open_file(self.h5fname, "r")

Callers 1

setUpMethod · 0.95

Calls 2

create_vlarrayMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected