Esempio n. 1
0
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)
Esempio n. 2
0
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")
Esempio n. 3
0
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)
Esempio n. 4
0
def test_has_dims_str(da1):
    """Test if check works for a string."""
    assert has_dims(da1, "x", "arbitrary")
Esempio n. 5
0
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')