Assert that actual is an object array of either bytes or str. The exact contents (bytes or str) are allowed to diverge between h5py and versioned_hdf5.
(actual, expect)
| 24 | |
| 25 | |
| 26 | def assert_object_array_equal(actual, expect): |
| 27 | """Assert that actual is an object array of either bytes or str. |
| 28 | The exact contents (bytes or str) are allowed to diverge between h5py and |
| 29 | versioned_hdf5. |
| 30 | """ |
| 31 | actual = np.asarray(actual) |
| 32 | expect = np.asarray(expect, dtype=object) |
| 33 | assert actual.dtype.kind == "O" |
| 34 | assert actual.shape == expect.shape |
| 35 | |
| 36 | for a, b in zip(actual.flat, expect.flat, strict=True): |
| 37 | if isinstance(a, bytes): |
| 38 | a = a.decode("utf-8") |
| 39 | assert a == b, (actual, expect) |
| 40 | |
| 41 | |
| 42 | def assert_swaps_counter(ds, expect): |
no outgoing calls
no test coverage detected