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