Checking enlargeable array __setitem__ special method.
(self)
| 637 | self.assertEqual(len(self.shape), 1) |
| 638 | |
| 639 | def test05_setitemEArray(self): |
| 640 | """Checking enlargeable array __setitem__ special method.""" |
| 641 | |
| 642 | if self.__class__.__name__ == "Ellipsis6EArrayTestCase": |
| 643 | # We have a problem with test design here, but I think |
| 644 | # it is not worth the effort to solve it |
| 645 | # F.Alted 2004-10-27 |
| 646 | return |
| 647 | |
| 648 | if common.verbose: |
| 649 | print("\n", "-=" * 30) |
| 650 | print( |
| 651 | "Running %s.test05_setitemEArray..." % self.__class__.__name__ |
| 652 | ) |
| 653 | |
| 654 | if not hasattr(self, "slices"): |
| 655 | # If there is not a slices attribute, create it |
| 656 | # This conversion made just in case indices are numpy scalars |
| 657 | if self.start is not None: |
| 658 | self.start = int(self.start) |
| 659 | if self.stop is not None: |
| 660 | self.stop = int(self.stop) |
| 661 | if self.step is not None: |
| 662 | self.step = int(self.step) |
| 663 | self.slices = (slice(self.start, self.stop, self.step),) |
| 664 | |
| 665 | # Create an instance of an HDF5 Table |
| 666 | if self.reopen: |
| 667 | self._reopen(mode="a") |
| 668 | earray = self.h5file.get_node("/earray1") |
| 669 | |
| 670 | # Choose a small value for buffer size |
| 671 | # earray.nrowsinbuf = 3 # this does not really change the chunksize |
| 672 | if common.verbose: |
| 673 | print("EArray descr:", repr(earray)) |
| 674 | print("shape of read array ==>", earray.shape) |
| 675 | print("reopening?:", self.reopen) |
| 676 | |
| 677 | # Build the array to do comparisons |
| 678 | if self.type == "string": |
| 679 | object_ = np.ndarray( |
| 680 | buffer=b"a" * self.objsize, |
| 681 | shape=self.rowshape, |
| 682 | dtype=f"S{earray.atom.itemsize}", |
| 683 | ) |
| 684 | else: |
| 685 | object_ = np.arange(self.objsize, dtype=earray.atom.dtype.base) |
| 686 | object_.shape = self.rowshape |
| 687 | |
| 688 | object_ = object_.swapaxes(earray.extdim, 0) |
| 689 | |
| 690 | if self.obj is not None: |
| 691 | initialrows = len(self.obj) |
| 692 | else: |
| 693 | initialrows = 0 |
| 694 | |
| 695 | rowshape = self.rowshape |
| 696 | rowshape[self.extdim] *= self.nappends + initialrows |
nothing calls this directly
no test coverage detected