MCPcopy Index your code
hub / github.com/pydata/xarray / test_list_levels

Method test_list_levels

xarray/tests/test_plot.py:1046–1063  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1044 assert cmap_params["extend"] == "both"
1045
1046 def test_list_levels(self) -> None:
1047 data = self.data + 1
1048
1049 orig_levels = [0, 1, 2, 3, 4, 5]
1050 # vmin and vmax should be ignored if levels are explicitly provided
1051 cmap_params = _determine_cmap_params(data, levels=orig_levels, vmin=0, vmax=3)
1052 assert cmap_params["vmin"] is None
1053 assert cmap_params["vmax"] is None
1054 assert cmap_params["norm"].vmin == 0
1055 assert cmap_params["norm"].vmax == 5
1056 assert cmap_params["cmap"].N == 5
1057 assert cmap_params["norm"].N == 6
1058
1059 for wrap_levels in cast(
1060 list[Callable[[Any], dict[Any, Any]]], [list, np.array, pd.Index, DataArray]
1061 ):
1062 cmap_params = _determine_cmap_params(data, levels=wrap_levels(orig_levels))
1063 assert_array_equal(cmap_params["levels"], orig_levels)
1064
1065 def test_divergentcontrol(self) -> None:
1066 neg = self.data - 0.1

Callers

nothing calls this directly

Calls 1

_determine_cmap_paramsFunction · 0.90

Tested by

no test coverage detected