(self)
| 1851 | assert_identical(expected, actual) |
| 1852 | |
| 1853 | def test_roundtrip_character_array(self) -> None: |
| 1854 | with create_tmp_file() as tmp_file: |
| 1855 | values = np.array([["a", "b", "c"], ["d", "e", "f"]], dtype="S") |
| 1856 | |
| 1857 | with nc4.Dataset(tmp_file, mode="w") as nc: |
| 1858 | nc.createDimension("x", 2) |
| 1859 | nc.createDimension("string3", 3) |
| 1860 | v = nc.createVariable("x", np.dtype("S1"), ("x", "string3")) |
| 1861 | v[:] = values |
| 1862 | |
| 1863 | values = np.array(["abc", "def"], dtype="S") |
| 1864 | expected = Dataset({"x": ("x", values)}) |
| 1865 | with open_dataset(tmp_file) as actual: |
| 1866 | assert_identical(expected, actual) |
| 1867 | # regression test for #157 |
| 1868 | with self.roundtrip(actual) as roundtripped: |
| 1869 | assert_identical(expected, roundtripped) |
| 1870 | |
| 1871 | def test_default_to_char_arrays(self) -> None: |
| 1872 | data = Dataset({"x": np.array(["foo", "zzzz"], dtype="S")}) |
nothing calls this directly
no test coverage detected