Checking setting large string attributes (File methods)
(self)
| 38 | ) |
| 39 | |
| 40 | def test01_setAttributes(self): |
| 41 | """Checking setting large string attributes (File methods)""" |
| 42 | |
| 43 | attrlength = 2048 |
| 44 | # Try to put a long string attribute on a group object |
| 45 | self.h5file.set_node_attr(self.root.agroup, "attr1", "p" * attrlength) |
| 46 | |
| 47 | # Now, try with a Table object |
| 48 | self.h5file.set_node_attr(self.root.atable, "attr1", "a" * attrlength) |
| 49 | |
| 50 | # Finally, try with an Array object |
| 51 | self.h5file.set_node_attr(self.root.anarray, "attr1", "n" * attrlength) |
| 52 | |
| 53 | if self.close: |
| 54 | if common.verbose: |
| 55 | print("(closing file version)") |
| 56 | self._reopen(mode="r+", node_cache_slots=self.node_cache_slots) |
| 57 | self.root = self.h5file.root |
| 58 | |
| 59 | self.assertEqual( |
| 60 | self.h5file.get_node_attr(self.root.agroup, "attr1"), |
| 61 | "p" * attrlength, |
| 62 | ) |
| 63 | self.assertEqual( |
| 64 | self.h5file.get_node_attr(self.root.atable, "attr1"), |
| 65 | "a" * attrlength, |
| 66 | ) |
| 67 | self.assertEqual( |
| 68 | self.h5file.get_node_attr(self.root.anarray, "attr1"), |
| 69 | "n" * attrlength, |
| 70 | ) |
| 71 | |
| 72 | def reopen(self): |
| 73 | # Reopen |
nothing calls this directly
no test coverage detected