MCPcopy
hub / github.com/pydata/xarray / test_dropna

Method test_dropna

xarray/tests/test_backends.py:1059–1075  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1057 self.validate_array_type(actual)
1058
1059 def test_dropna(self) -> None:
1060 # regression test for GH:issue:1694
1061 a = np.random.randn(4, 3)
1062 a[1, 1] = np.nan
1063 in_memory = xr.Dataset(
1064 {"a": (("y", "x"), a)}, coords={"y": np.arange(4), "x": np.arange(3)}
1065 )
1066
1067 assert_identical(
1068 in_memory.dropna(dim="x"), in_memory.isel(x=slice(None, None, 2))
1069 )
1070
1071 with self.roundtrip(in_memory) as on_disk:
1072 self.validate_array_type(on_disk)
1073 expected = in_memory.dropna(dim="x")
1074 actual = on_disk.dropna(dim="x")
1075 assert_identical(expected, actual)
1076
1077 def test_ondisk_after_print(self) -> None:
1078 """Make sure print does not load file into memory"""

Callers

nothing calls this directly

Calls 6

dropnaMethod · 0.95
iselMethod · 0.95
roundtripMethod · 0.95
validate_array_typeMethod · 0.95
assert_identicalFunction · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected