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

Method test05_where

tables/tests/test_enum.py:382–410  ·  view source on GitHub ↗

Searching enumerated data.

(self)

Source from the content-addressed store, hash-verified

380 )
381
382 def test05_where(self):
383 """Searching enumerated data."""
384
385 tbl = self.h5file.create_table(
386 "/", "test", self._description(), title=self._getMethodName()
387 )
388
389 appended = [
390 (10, self.valueInEnum),
391 (20, self.valueInEnum),
392 (30, self.valueOutOfEnum),
393 ]
394 tbl.append(appended)
395 tbl.flush()
396
397 searched = [
398 (row["rid"], row["rcolor"])
399 for row in tbl.where("rcolor == v", {"v": self.valueInEnum})
400 ]
401 common.verbosePrint(
402 "* ``valueInEnum``: %s\n"
403 "* ``rcolor`` column: ``%s``\n"
404 "* ``searched``: %s\n"
405 "* Should look like: %s\n"
406 % (self.valueInEnum, tbl.cols.rcolor, searched, appended[:-1])
407 )
408 self.assertEqual(
409 searched, appended[:-1], "Search returned incorrect results."
410 )
411
412
413class EnumEArrayTestCase(common.TempFileMixin, common.PyTablesTestCase):

Callers

nothing calls this directly

Calls 6

_descriptionMethod · 0.95
_getMethodNameMethod · 0.80
whereMethod · 0.80
create_tableMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected