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

Method test_norm_sets_vmin_vmax

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

Source from the content-addressed store, hash-verified

1141 assert cmap_params["cmap"].name == "RdBu_r"
1142
1143 def test_norm_sets_vmin_vmax(self) -> None:
1144 vmin = self.data.min()
1145 vmax = self.data.max()
1146
1147 for norm, extend, levels in zip(
1148 [
1149 mpl.colors.Normalize(),
1150 mpl.colors.Normalize(),
1151 mpl.colors.Normalize(vmin + 0.1, vmax - 0.1),
1152 mpl.colors.Normalize(None, vmax - 0.1),
1153 mpl.colors.Normalize(vmin + 0.1, None),
1154 ],
1155 ["neither", "neither", "both", "max", "min"],
1156 [7, None, None, None, None],
1157 strict=True,
1158 ):
1159 test_min = vmin if norm.vmin is None else norm.vmin
1160 test_max = vmax if norm.vmax is None else norm.vmax
1161
1162 cmap_params = _determine_cmap_params(self.data, norm=norm, levels=levels)
1163 assert cmap_params["vmin"] is None
1164 assert cmap_params["vmax"] is None
1165 assert cmap_params["norm"].vmin == test_min
1166 assert cmap_params["norm"].vmax == test_max
1167 assert cmap_params["extend"] == extend
1168 assert cmap_params["norm"] == norm
1169
1170
1171@requires_matplotlib

Callers

nothing calls this directly

Calls 3

_determine_cmap_paramsFunction · 0.90
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected