diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index a2a6bd4fa..90f5e2a1c 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -498,7 +498,7 @@ class VTK: # string array return np.array([vtk_array.GetValue(i) for i in range(vtk_array.GetNumberOfValues())]).astype(str) except UnboundLocalError: - raise ValueError(f'array "{label}" not found') + raise KeyError(f'array "{label}" not found') def show(self, diff --git a/python/tests/test_Grid.py b/python/tests/test_Grid.py index c453b6c74..4ef62ff93 100644 --- a/python/tests/test_Grid.py +++ b/python/tests/test_Grid.py @@ -61,7 +61,7 @@ class TestGrid: def test_invalid_no_material(self,tmp_path): v = VTK.from_image_data(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0) v.save(tmp_path/'no_materialpoint.vti',parallel=False) - with pytest.raises(ValueError): + with pytest.raises(KeyError): Grid.load(tmp_path/'no_materialpoint.vti') def test_invalid_material_type(self): diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index fc2ca179b..684a05678 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -141,7 +141,7 @@ class TestVTK: def test_invalid_get(self,default): - with pytest.raises(ValueError): + with pytest.raises(KeyError): default.get('does_not_exist') def test_invalid_add_shape(self,default):