Appending enumerated values using ``row.append()``.
(self)
| 275 | ) |
| 276 | |
| 277 | def test01_rowAppend(self): |
| 278 | """Appending enumerated values using ``row.append()``.""" |
| 279 | |
| 280 | tbl = self.h5file.create_table( |
| 281 | "/", "test", self._description(), title=self._getMethodName() |
| 282 | ) |
| 283 | |
| 284 | appended = [(10, self.valueInEnum), (20, self.valueOutOfEnum)] |
| 285 | |
| 286 | row = tbl.row |
| 287 | |
| 288 | row["rid"] = appended[0][0] |
| 289 | row["rcolor"] = appended[0][1] |
| 290 | row.append() |
| 291 | |
| 292 | row["rid"] = appended[1][0] |
| 293 | self.assertRaises( |
| 294 | ValueError, operator.setitem, row, "rcolor", appended[1][1] |
| 295 | ) |
| 296 | |
| 297 | tbl.flush() |
| 298 | tbl.flavor = "python" |
| 299 | read = tbl.read() |
| 300 | common.verbosePrint( |
| 301 | "* appended value: %s\n" |
| 302 | "* read value: %s\n" % (appended[:-1], read) |
| 303 | ) |
| 304 | self.assertEqual( |
| 305 | appended[:-1], read, "Written and read values differ." |
| 306 | ) |
| 307 | |
| 308 | def test02_append(self): |
| 309 | """Appending enumerated values using ``table.append()``.""" |
nothing calls this directly
no test coverage detected