Checking read() of enlargeable arrays.
(self)
| 302 | self.assertEqual(len(shape), 1) |
| 303 | |
| 304 | def test03_readEArray(self): |
| 305 | """Checking read() of enlargeable arrays.""" |
| 306 | |
| 307 | if common.verbose: |
| 308 | print("\n", "-=" * 30) |
| 309 | print("Running %s.test03_readEArray..." % self.__class__.__name__) |
| 310 | |
| 311 | # This conversion made just in case indices are numpy scalars |
| 312 | if self.start is not None: |
| 313 | self.start = int(self.start) |
| 314 | if self.stop is not None: |
| 315 | self.stop = int(self.stop) |
| 316 | if self.step is not None: |
| 317 | self.step = int(self.step) |
| 318 | |
| 319 | # Create an instance of an HDF5 Table |
| 320 | if self.reopen: |
| 321 | self._reopen() |
| 322 | earray = self.h5file.get_node("/earray1") |
| 323 | |
| 324 | # Choose a small value for buffer size |
| 325 | earray.nrowsinbuf = 3 |
| 326 | if common.verbose: |
| 327 | print("EArray descr:", repr(earray)) |
| 328 | print("shape of read array ==>", earray.shape) |
| 329 | print("reopening?:", self.reopen) |
| 330 | |
| 331 | # Build the array to do comparisons |
| 332 | if self.type == "string": |
| 333 | object_ = np.ndarray( |
| 334 | buffer=b"a" * self.objsize, |
| 335 | shape=self.rowshape, |
| 336 | dtype="S%s" % earray.atom.itemsize, |
| 337 | ) |
| 338 | else: |
| 339 | object_ = np.arange(self.objsize, dtype=earray.atom.dtype.base) |
| 340 | object_.shape = self.rowshape |
| 341 | object_ = object_.swapaxes(earray.extdim, 0) |
| 342 | |
| 343 | if self.obj is not None: |
| 344 | initialrows = len(self.obj) |
| 345 | else: |
| 346 | initialrows = 0 |
| 347 | |
| 348 | rowshape = self.rowshape |
| 349 | rowshape[self.extdim] *= self.nappends + initialrows |
| 350 | if self.type == "string": |
| 351 | object__ = np.empty( |
| 352 | shape=rowshape, dtype=f"S{earray.atom.itemsize}" |
| 353 | ) |
| 354 | else: |
| 355 | object__ = np.empty(shape=rowshape, dtype=self.dtype) |
| 356 | |
| 357 | object__ = object__.swapaxes(0, self.extdim) |
| 358 | |
| 359 | if initialrows: |
| 360 | object__[0:initialrows] = self.obj |
| 361 |
nothing calls this directly
no test coverage detected