Skip to content

Commit 375902b

Browse files
ischoeglspeth
authored andcommitted
Add unit test for CSV import with single row
1 parent 7f78ec5 commit 375902b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

interfaces/cython/cantera/test/test_composite.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,21 @@ def test_write_csv(self):
191191
self.assertArrayNear(states.P, b.P)
192192
self.assertArrayNear(states.X, b.X)
193193

194+
def test_write_csv_single_row(self):
195+
gas = ct.Solution("gri30.yaml")
196+
states = ct.SolutionArray(gas)
197+
states.append(T=300., P=ct.one_atm, X="CH4:0.5, O2:0.4")
198+
states.equilibrate("HP")
199+
200+
outfile = self.test_work_path / "solutionarray.csv"
201+
states.write_csv(outfile)
202+
203+
b = ct.SolutionArray(gas)
204+
b.read_csv(outfile)
205+
self.assertArrayNear(states.T, b.T)
206+
self.assertArrayNear(states.P, b.P)
207+
self.assertArrayNear(states.X, b.X)
208+
194209
def test_write_csv_str_column(self):
195210
states = ct.SolutionArray(self.gas, 3, extra={'spam': 'eggs'})
196211

0 commit comments

Comments
 (0)