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

Function table_description

tables/tests/test_queries.py:134–161  ·  view source on GitHub ↗

Return a table description for testing queries. The description consists of all PyTables data types, both in the top level and in the ``c_nested`` nested column. A column of a certain TYPE gets called ``c_TYPE``. An extra integer column ``c_extra`` is also provided. If a `shape`

(classname, nclassname, shape=())

Source from the content-addressed store, hash-verified

132
133
134def table_description(classname, nclassname, shape=()):
135 """Return a table description for testing queries.
136
137 The description consists of all PyTables data types, both in the
138 top level and in the ``c_nested`` nested column. A column of a
139 certain TYPE gets called ``c_TYPE``. An extra integer column
140 ``c_extra`` is also provided. If a `shape` is given, it will be
141 used for all columns. Finally, an extra indexed column
142 ``c_idxextra`` is added as well in order to provide some basic
143 tests for multi-index queries.
144
145 """
146 classdict = {}
147 colpos = append_columns(classdict, shape)
148
149 ndescr = nested_description(nclassname, colpos, shape=shape)
150 classdict["c_nested"] = ndescr
151 colpos += 1
152
153 extracol = tb.IntCol(shape=shape, pos=colpos)
154 classdict["c_extra"] = extracol
155 colpos += 1
156
157 idxextracol = tb.IntCol(shape=shape, pos=colpos)
158 classdict["c_idxextra"] = idxextracol
159 colpos += 1
160
161 return type(classname, (tb.IsDescription,), classdict)
162
163
164TableDescription = table_description("TableDescription", "NestedDescription")

Callers 1

test_queries.pyFile · 0.85

Calls 2

append_columnsFunction · 0.85
nested_descriptionFunction · 0.85

Tested by

no test coverage detected