Beispiel #1
0
def test_getarray_noinit_noinit():
    """Test that calling on a non-existant array does not initialize that array"""
    arr = np.ones((5, 5))
    model = ImageModel(data=arr)
    try:
        model.getarray_noinit('area')
    except AttributeError:
        pass
    assert 'area' not in model.instance
Beispiel #2
0
def test_getarray_noinit_raises():
    """Test for error when accessing non-existent array"""
    arr = np.ones((5, 5))
    model = ImageModel(data=arr)
    with pytest.raises(AttributeError):
        model.getarray_noinit('area')
Beispiel #3
0
def test_getarray_noinit_valid():
    """Test for valid value return"""
    arr = np.ones((5, 5))
    model = ImageModel(data=arr)
    fetched = model.getarray_noinit('data')
    assert (fetched == arr).all()