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

Method populateFile

tables/tests/test_indexes.py:38–66  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36 self.h5file.close()
37
38 def populateFile(self):
39 group = self.rootgroup
40 # Create a table
41 title = "This is the IndexArray title"
42 self.filters = tb.Filters(
43 complevel=self.compress,
44 complib=self.complib,
45 shuffle=self.shuffle,
46 fletcher32=self.fletcher32,
47 )
48 table = self.h5file.create_table(
49 group, "table", TDescr, title, self.filters, self.nrows
50 )
51 for i in range(self.nrows):
52 table.row["var1"] = str(i).encode("ascii")
53 # table.row['var2'] = i > 2
54 table.row["var2"] = i % 2
55 table.row["var3"] = i
56 table.row["var4"] = float(self.nrows - i - 1)
57 table.row.append()
58 table.flush()
59 # Index all entries:
60 for col in table.colinstances.values():
61 indexrows = col.create_index(_blocksizes=small_blocksizes)
62 if common.verbose:
63 print("Number of written rows:", self.nrows)
64 print("Number of indexed rows:", indexrows)
65
66 return
67
68 def test00_flushLastRow(self):
69 """Checking flushing an Index incrementing only the last row."""

Callers 1

setUpMethod · 0.95

Calls 5

create_indexMethod · 0.80
create_tableMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected