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=())
| 132 | |
| 133 | |
| 134 | def 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 | |
| 164 | TableDescription = table_description("TableDescription", "NestedDescription") |
no test coverage detected