diff --git a/python/damask/table.py b/python/damask/table.py index 582089a54..3ef824c6d 100644 --- a/python/damask/table.py +++ b/python/damask/table.py @@ -74,7 +74,7 @@ class Table(): f.seek(0) try: - N_comment_lines,keyword = f.readline().split() + N_comment_lines,keyword = f.readline().strip().split(maxsplit=1) if keyword != 'header': raise TypeError else: diff --git a/python/tests/test_Table.py b/python/tests/test_Table.py index eed7b76b8..369a99efb 100644 --- a/python/tests/test_Table.py +++ b/python/tests/test_Table.py @@ -47,6 +47,13 @@ class TestTable: new = Table.from_ASCII(f) assert all(default.data==new.data) and default.shapes == new.shapes + def test_write_read_new_style(self,default,tmpdir): + with open(tmpdir.join('new_style.txt'),'w') as f: + default.to_ASCII(f,new=True) + with open(tmpdir.join('new_style.txt')) as f: + new = Table.from_ASCII(f) + assert all(default.data==new.data) and default.shapes == new.shapes + def test_read_ang_str(self,reference_dir): new = Table.from_ang(os.path.join(reference_dir,'simple.ang')) assert new.data.shape == (4,10) and \