def test_has_dims_list_fail(da1): """Test if check fails properly for a list.""" with pytest.raises(DimensionError) as e: has_dims(da1, ["z"], "arbitrary") assert "Your arbitrary object must contain" in str(e.value)
def test_has_dims_list(da1): """Test if check works for a list.""" # returns None if no errors assert has_dims(da1, ["x", "y"], "arbitrary")
def test_has_dims_str_fail(da1): """Test if check fails properly for a string.""" with pytest.raises(DimensionError) as e: has_dims(da1, 'z', 'arbitrary') assert 'Your arbitrary object must contain' in str(e.value)
def test_has_dims_str(da1): """Test if check works for a string.""" assert has_dims(da1, "x", "arbitrary")
def test_has_dims_list(da1): """Test if check works for a list.""" # returns None if no errors assert has_dims(da1, ['x', 'y'], 'arbitrary')