Checking earray with byteswapped appends (2, floats)
(self)
| 1750 | self.assertTrue(common.allequal(native, swapped)) |
| 1751 | |
| 1752 | def test04c_float(self): |
| 1753 | """Checking earray with byteswapped appends (2, floats)""" |
| 1754 | |
| 1755 | root = self.rootgroup |
| 1756 | if common.verbose: |
| 1757 | print("\n", "-=" * 30) |
| 1758 | print("Running %s.test04c_float..." % self.__class__.__name__) |
| 1759 | |
| 1760 | byteorder = {"little": "big", "big": "little"}[sys.byteorder] |
| 1761 | earray = self.h5file.create_earray( |
| 1762 | root, |
| 1763 | "EAtom", |
| 1764 | atom=tb.Float64Atom(), |
| 1765 | shape=(0, 3), |
| 1766 | title="array of floats", |
| 1767 | byteorder=byteorder, |
| 1768 | ) |
| 1769 | # Add a native ordered array |
| 1770 | a = np.array( |
| 1771 | [(0, 0, 0), (1, 0, 3), (1, 1, 1), (3, 3, 3)], dtype="float64" |
| 1772 | ) |
| 1773 | earray.append(a) |
| 1774 | # Change the byteorder of the array |
| 1775 | a = a.byteswap() |
| 1776 | a = a.view(a.dtype.newbyteorder()) |
| 1777 | # Add a byteswapped array |
| 1778 | earray.append(a) |
| 1779 | |
| 1780 | # Read all the rows: |
| 1781 | native = earray[:4, :] |
| 1782 | swapped = earray[4:, :] |
| 1783 | if common.verbose: |
| 1784 | print( |
| 1785 | "Byteorder native rows:", |
| 1786 | tb.utils.byteorders[native.dtype.byteorder], |
| 1787 | ) |
| 1788 | print("Byteorder earray on-disk:", earray.byteorder) |
| 1789 | |
| 1790 | self.assertEqual( |
| 1791 | tb.utils.byteorders[native.dtype.byteorder], sys.byteorder |
| 1792 | ) |
| 1793 | self.assertEqual(earray.byteorder, byteorder) |
| 1794 | self.assertTrue(common.allequal(native, swapped)) |
| 1795 | |
| 1796 | def test04d_float(self): |
| 1797 | """Checking earray with byteswapped appends (2, floats, reopen)""" |
nothing calls this directly
no test coverage detected