diff --git a/CHANGELOG.md b/CHANGELOG.md index 727cf00d99..0741df552b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ * Fix `legend` argument in `plot_separation` ([1701](https://github.com/arviz-devs/arviz/pull/1701)) * Removed testing dependency on http download for radon dataset ([1717](https://github.com/arviz-devs/arviz/pull/1717)) * Fixed plot_kde to take labels with kwargs. ([1710](https://github.com/arviz-devs/arviz/pull/1710)) +* Fixed xarray related tests. ([1726](https://github.com/arviz-devs/arviz/pull/1726)) * Fix Bokeh deprecation warnings ([1657](https://github.com/arviz-devs/arviz/pull/1657)) ### Deprecation diff --git a/arviz/tests/base_tests/test_plot_utils.py b/arviz/tests/base_tests/test_plot_utils.py index 54908ad695..faef487655 100644 --- a/arviz/tests/base_tests/test_plot_utils.py +++ b/arviz/tests/base_tests/test_plot_utils.py @@ -136,16 +136,18 @@ def test_xarray_sel_data_array(sample_dataset): # pylint: disable=invalid-name class TestCoordsExceptions: # test coord exceptions on datasets - @pytest.mark.skipif( - True, reason="Skip test until we figure out how to handle the new xarray errors" - ) def test_invalid_coord_name(self, sample_dataset): # pylint: disable=invalid-name """Assert that nicer exception appears when user enters wrong coords name""" _, _, data = sample_dataset coords = {"NOT_A_COORD_NAME": [1]} with pytest.raises( - ValueError, match="Coords {'NOT_A_COORD_NAME'} are invalid coordinate keys" + (KeyError, ValueError), + match=( + r"Coords " + r"({'NOT_A_COORD_NAME'} are invalid coordinate keys" + r"|should follow mapping format {coord_name:\[dim1, dim2\]})" + ), ): get_coords(data, coords) @@ -168,16 +170,18 @@ def test_invalid_coord_structure(self, sample_dataset): # pylint: disable=inval get_coords(data, coords) # test coord exceptions on dataset list - @pytest.mark.skipif( - True, reason="Skip test until we figure out how to handle the new xarray errors" - ) def test_invalid_coord_name_list(self, sample_dataset): # pylint: disable=invalid-name """Assert that nicer exception appears when user enters wrong coords name""" _, _, data = sample_dataset coords = {"NOT_A_COORD_NAME": [1]} with pytest.raises( - ValueError, match=r"data\[1\]:.+Coords {'NOT_A_COORD_NAME'} are invalid coordinate keys" + (KeyError, ValueError), + match=( + r"data\[1\]:.+Coords " + r"({'NOT_A_COORD_NAME'} are invalid coordinate keys" + r"|should follow mapping format {coord_name:\[dim1, dim2\]})" + ), ): get_coords((data, data), ({"draw": [0, 1]}, coords))