Checking enlargeable array __getitem__ special method.
(self)
| 532 | self.assertEqual(len(shape), 1) |
| 533 | |
| 534 | def test04_getitemEArray(self): |
| 535 | """Checking enlargeable array __getitem__ special method.""" |
| 536 | |
| 537 | if common.verbose: |
| 538 | print("\n", "-=" * 30) |
| 539 | print( |
| 540 | "Running %s.test04_getitemEArray..." % self.__class__.__name__ |
| 541 | ) |
| 542 | |
| 543 | if not hasattr(self, "slices"): |
| 544 | # If there is not a slices attribute, create it |
| 545 | # This conversion made just in case indices are numpy scalars |
| 546 | if self.start is not None: |
| 547 | self.start = int(self.start) |
| 548 | if self.stop is not None: |
| 549 | self.stop = int(self.stop) |
| 550 | if self.step is not None: |
| 551 | self.step = int(self.step) |
| 552 | self.slices = (slice(self.start, self.stop, self.step),) |
| 553 | |
| 554 | # Create an instance of an HDF5 Table |
| 555 | if self.reopen: |
| 556 | self._reopen() |
| 557 | earray = self.h5file.get_node("/earray1") |
| 558 | |
| 559 | # Choose a small value for buffer size |
| 560 | # earray.nrowsinbuf = 3 # this does not really change the chunksize |
| 561 | if common.verbose: |
| 562 | print("EArray descr:", repr(earray)) |
| 563 | print("shape of read array ==>", earray.shape) |
| 564 | print("reopening?:", self.reopen) |
| 565 | |
| 566 | # Build the array to do comparisons |
| 567 | if self.type == "string": |
| 568 | object_ = np.ndarray( |
| 569 | buffer=b"a" * self.objsize, |
| 570 | shape=self.rowshape, |
| 571 | dtype=f"S{earray.atom.itemsize}", |
| 572 | ) |
| 573 | else: |
| 574 | object_ = np.arange(self.objsize, dtype=earray.atom.dtype.base) |
| 575 | object_.shape = self.rowshape |
| 576 | |
| 577 | object_ = object_.swapaxes(earray.extdim, 0) |
| 578 | |
| 579 | if self.obj is not None: |
| 580 | initialrows = len(self.obj) |
| 581 | else: |
| 582 | initialrows = 0 |
| 583 | |
| 584 | rowshape = self.rowshape |
| 585 | rowshape[self.extdim] *= self.nappends + initialrows |
| 586 | if self.type == "string": |
| 587 | object__ = np.empty( |
| 588 | shape=rowshape, dtype=f"S{earray.atom.itemsize}" |
| 589 | ) |
| 590 | else: |
| 591 | object__ = np.empty(shape=rowshape, dtype=self.dtype) |
nothing calls this directly
no test coverage detected