test exotic input files
This commit is contained in:
parent
5fdf112f78
commit
2172e92e7e
|
@ -0,0 +1,4 @@
|
||||||
|
1 header
|
||||||
|
a b
|
||||||
|
1.0 hallo
|
||||||
|
0.1 "hallo test"
|
|
@ -0,0 +1,6 @@
|
||||||
|
1 header
|
||||||
|
a b 1_c 2_c
|
||||||
|
1 2 3 4
|
||||||
|
5 6 7 8
|
||||||
|
9 10. 12. 12
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from damask import Table
|
from damask import Table
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def default():
|
def default():
|
||||||
"""Simple Table."""
|
"""Simple Table."""
|
||||||
x = np.ones((5,13))
|
x = np.ones((5,13))
|
||||||
return Table(x,{'F':(3,3),'v':(3,),'s':(1,)},['test data','contains only ones'])
|
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:
|
class TestTable:
|
||||||
|
|
||||||
|
@ -31,6 +38,11 @@ class TestTable:
|
||||||
with open(tmpdir.join('default.txt')) as f:
|
with open(tmpdir.join('default.txt')) as f:
|
||||||
new = Table.from_ASCII(f)
|
new = Table.from_ASCII(f)
|
||||||
assert all(default.data==new.data)
|
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):
|
def test_set_array(self,default):
|
||||||
default.set_array('F',np.zeros((5,3,3)),'set to zero')
|
default.set_array('F',np.zeros((5,3,3)),'set to zero')
|
||||||
|
|
Loading…
Reference in New Issue