Searching enumerated data.
(self)
| 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 | |
| 413 | class EnumEArrayTestCase(common.TempFileMixin, common.PyTablesTestCase): |
nothing calls this directly
no test coverage detected