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

Method test_default_labels

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

Source from the content-addressed store, hash-verified

2554
2555 @pytest.mark.slow
2556 def test_default_labels(self) -> None:
2557 g = xplt.FacetGrid(self.darray, col="col", row="row")
2558 assert (2, 3) == g.axs.shape
2559
2560 g.map_dataarray(xplt.imshow, "x", "y")
2561
2562 # Rightmost column should be labeled
2563 for label, ax in zip(
2564 self.darray.coords["row"].values, g.axs[:, -1], strict=True
2565 ):
2566 assert substring_in_axes(label, ax)
2567
2568 # Top row should be labeled
2569 for label, ax in zip(
2570 self.darray.coords["col"].values, g.axs[0, :], strict=True
2571 ):
2572 assert substring_in_axes(label, ax)
2573
2574 # ensure that row & col labels can be changed
2575 g.set_titles("abc={value}")
2576 for label, ax in zip(
2577 self.darray.coords["row"].values, g.axs[:, -1], strict=True
2578 ):
2579 assert substring_in_axes(f"abc={label}", ax)
2580 # previous labels were "row=row0" etc.
2581 assert substring_not_in_axes("row=", ax)
2582
2583 for label, ax in zip(
2584 self.darray.coords["col"].values, g.axs[0, :], strict=True
2585 ):
2586 assert substring_in_axes(f"abc={label}", ax)
2587 # previous labels were "col=row0" etc.
2588 assert substring_not_in_axes("col=", ax)
2589
2590
2591@pytest.mark.filterwarnings("ignore:tight_layout cannot")

Callers

nothing calls this directly

Calls 4

map_dataarrayMethod · 0.95
set_titlesMethod · 0.95
substring_in_axesFunction · 0.85
substring_not_in_axesFunction · 0.85

Tested by

no test coverage detected