diff --git a/python/tests/reference/Table/datatype-mix.txt b/python/tests/reference/Table/datatype-mix.txt new file mode 100644 index 000000000..2f6baa852 --- /dev/null +++ b/python/tests/reference/Table/datatype-mix.txt @@ -0,0 +1,4 @@ +1 header +a b +1.0 hallo +0.1 "hallo test" diff --git a/python/tests/reference/Table/whitespace-mix.txt b/python/tests/reference/Table/whitespace-mix.txt new file mode 100644 index 000000000..933a16e77 --- /dev/null +++ b/python/tests/reference/Table/whitespace-mix.txt @@ -0,0 +1,6 @@ +1 header +a b 1_c 2_c +1 2 3 4 +5 6 7 8 +9 10. 12. 12 + diff --git a/python/tests/test_Table.py b/python/tests/test_Table.py index c34f9ee3a..e7550984d 100644 --- a/python/tests/test_Table.py +++ b/python/tests/test_Table.py @@ -1,14 +1,21 @@ +import os + import pytest import numpy as np from damask import Table + @pytest.fixture def default(): """Simple Table.""" x = np.ones((5,13)) return Table(x,{'F':(3,3),'v':(3,),'s':(1,)},['test data','contains only ones']) +@pytest.fixture +def reference_dir(reference_dir_base): + """Directory containing reference results.""" + return os.path.join(reference_dir_base,'Table') class TestTable: @@ -31,6 +38,11 @@ class TestTable: with open(tmpdir.join('default.txt')) as f: new = Table.from_ASCII(f) assert all(default.data==new.data) + + @pytest.mark.parametrize('fname',['datatype-mix.txt','whitespace-mix.txt']) + def test_read_strange(self,reference_dir,fname): + with open(os.path.join(reference_dir,fname)) as f: + new = Table.from_ASCII(f) def test_set_array(self,default): default.set_array('F',np.zeros((5,3,3)),'set to zero')