Checking removing attributes (using File.del_node_attr())
(self)
| 345 | ) |
| 346 | |
| 347 | def test05b_removeAttributes(self): |
| 348 | """Checking removing attributes (using File.del_node_attr())""" |
| 349 | |
| 350 | # With a Group object |
| 351 | self.group._v_attrs.pq = "1" |
| 352 | self.group._v_attrs.qr = "2" |
| 353 | self.group._v_attrs.rs = "3" |
| 354 | # delete an attribute |
| 355 | self.h5file.del_node_attr(self.group, "pq") |
| 356 | |
| 357 | if self.close: |
| 358 | if common.verbose: |
| 359 | print("(closing file version)") |
| 360 | self._reopen(mode="r+", node_cache_slots=self.node_cache_slots) |
| 361 | self.root = self.h5file.root |
| 362 | |
| 363 | agroup = self.root.agroup |
| 364 | if common.verbose: |
| 365 | print("Attribute list:", agroup._v_attrs._f_list()) |
| 366 | # Check the local attributes names |
| 367 | self.assertEqual(agroup._v_attrs._f_list(), ["qr", "rs"]) |
| 368 | if common.verbose: |
| 369 | print("Attribute list in disk:", agroup._v_attrs._f_list("all")) |
| 370 | # Check the disk attribute names |
| 371 | self.assertEqual( |
| 372 | agroup._v_attrs._f_list("all"), |
| 373 | ["CLASS", "TITLE", "VERSION", "qr", "rs"], |
| 374 | ) |
| 375 | |
| 376 | # delete an attribute (File.del_node_attr method) |
| 377 | self.h5file.del_node_attr(self.root, "qr", "agroup") |
| 378 | if common.verbose: |
| 379 | print("Attribute list:", agroup._v_attrs._f_list()) |
| 380 | # Check the local attributes names |
| 381 | self.assertEqual(agroup._v_attrs._f_list(), ["rs"]) |
| 382 | if common.verbose: |
| 383 | print("Attribute list in disk:", agroup._v_attrs._f_list()) |
| 384 | # Check the disk attribute names |
| 385 | self.assertEqual( |
| 386 | agroup._v_attrs._f_list("all"), ["CLASS", "TITLE", "VERSION", "rs"] |
| 387 | ) |
| 388 | |
| 389 | def test06_removeAttributes(self): |
| 390 | """Checking removing system attributes.""" |
nothing calls this directly
no test coverage detected