From 30938a8278a5e9ad800a2fb4b28a6c6a6ffb5191 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 5 Nov 2020 21:38:00 +0100 Subject: [PATCH] correct order (brackets) --- python/damask/_vtk.py | 2 +- python/tests/test_VTK.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 9cfcca2ec..942be4f1f 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -199,7 +199,7 @@ class VTK: default_ext = '.'+writer.GetDefaultFileExtension() ext = Path(fname).suffix - writer.SetFileName(str(fname)+default_ext if default_ext != ext else '') + writer.SetFileName(str(fname)+(default_ext if default_ext != ext else '')) if compress: writer.SetCompressorTypeToZLib() diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index 70d91659a..bab6051b0 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -98,9 +98,10 @@ class TestVTK: with pytest.raises(TypeError): VTK.load(name,dataset_type) - def test_invalid_extension_write(self,default): - with pytest.raises(ValueError): - default.save('default.txt') + def test_add_extension(self,tmp_path,default): + default.save(tmp_path/'default.txt',parallel=False) + assert os.path.isfile(tmp_path/'default.txt.vtr') + def test_invalid_get(self,default): with pytest.raises(ValueError):