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

Method test05_maxFieldsExceeded

tables/tests/test_create.py:183–219  ·  view source on GitHub ↗

Checking an excess of the maximum number of fields in tables

(self)

Source from the content-addressed store, hash-verified

181
182 # The next limitation has been released. A warning is still there, though
183 def test05_maxFieldsExceeded(self):
184 """Checking an excess of the maximum number of fields in tables"""
185
186 # The number of fields for a table
187 varnumber = tb.parameters.MAX_COLUMNS + 1
188
189 varnames = []
190 for i in range(varnumber):
191 varnames.append("int%d" % i)
192
193 # Build a dictionary with the types as values and varnames as keys
194 recordDict = {}
195 i = 0
196 for varname in varnames:
197 recordDict[varname] = tb.Col.from_type("int32", dflt=1)
198 i += 1
199
200 # Now, create a table with this record object
201 # This way of creating node objects has been deprecated
202 # table = Table(recordDict, "MetaRecord instance")
203
204 # Attach the table to object tree
205 warnings.filterwarnings("error", category=tb.PerformanceWarning)
206 # Here, a tables.PerformanceWarning should be raised!
207 try:
208 self.h5file.create_table(
209 self.root, "table", recordDict, "MetaRecord instance"
210 )
211 except tb.PerformanceWarning:
212 if common.verbose:
213 type, value, traceback = sys.exc_info()
214 print("\nGreat!, the next PerformanceWarning was catched!")
215 print(value)
216 else:
217 self.fail("expected an tables.PerformanceWarning")
218 # Reset the warning
219 warnings.filterwarnings("default", category=tb.PerformanceWarning)
220
221 # The next limitation has been released
222 def _test06_maxColumnNameLengthExceeded(self):

Callers

nothing calls this directly

Calls 3

appendMethod · 0.45
from_typeMethod · 0.45
create_tableMethod · 0.45

Tested by

no test coverage detected