Checking enlargeable array iterator.
(self)
| 125 | self.assertEqual(obj.atom.type, self.type) |
| 126 | |
| 127 | def test01_iterEArray(self): |
| 128 | """Checking enlargeable array iterator.""" |
| 129 | |
| 130 | if common.verbose: |
| 131 | print("\n", "-=" * 30) |
| 132 | print("Running %s.test01_iterEArray..." % self.__class__.__name__) |
| 133 | |
| 134 | # Create an instance of an HDF5 Table |
| 135 | if self.reopen: |
| 136 | self._reopen() |
| 137 | earray = self.h5file.get_node("/earray1") |
| 138 | |
| 139 | # Choose a small value for buffer size |
| 140 | earray.nrowsinbuf = 3 |
| 141 | if common.verbose: |
| 142 | print("EArray descr:", repr(earray)) |
| 143 | print("shape of read array ==>", earray.shape) |
| 144 | print("reopening?:", self.reopen) |
| 145 | |
| 146 | # Build the array to do comparisons |
| 147 | if self.type == "string": |
| 148 | object_ = np.ndarray( |
| 149 | buffer=b"a" * self.objsize, |
| 150 | shape=self.rowshape, |
| 151 | dtype="S%s" % earray.atom.itemsize, |
| 152 | ) |
| 153 | else: |
| 154 | object_ = np.arange(self.objsize, dtype=earray.atom.dtype.base) |
| 155 | object_.shape = self.rowshape |
| 156 | object_ = object_.swapaxes(earray.extdim, 0) |
| 157 | |
| 158 | if self.obj is not None: |
| 159 | initialrows = len(self.obj) |
| 160 | else: |
| 161 | initialrows = 0 |
| 162 | |
| 163 | shape = self._get_shape() |
| 164 | |
| 165 | # Read all the array |
| 166 | for idx, row in enumerate(earray): |
| 167 | if idx < initialrows: |
| 168 | self.assertTrue( |
| 169 | common.allequal( |
| 170 | row, np.asarray(self.obj[idx]), self.flavor |
| 171 | ) |
| 172 | ) |
| 173 | continue |
| 174 | |
| 175 | chunk = int((earray.nrow - initialrows) % self.chunksize) |
| 176 | if chunk == 0: |
| 177 | if self.type == "string": |
| 178 | object__ = object_ |
| 179 | else: |
| 180 | i = int(earray.nrow - initialrows) |
| 181 | object__ = object_ * (i // self.chunksize) |
| 182 | |
| 183 | object = object__[chunk] |
| 184 | # The next adds much more verbosity |
nothing calls this directly
no test coverage detected