Skip to content

Commit

Permalink
[UnitTests] Add unit test for propagated SolutionArray 'extra'
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Mar 3, 2022
1 parent d411f6c commit 9c1651d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions interfaces/cython/cantera/test/test_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ def test_collect_data(self):
self.assertIn('X', collected)
self.assertEqual(collected['X'].shape, (0, self.gas.n_species))

def test_getitem(self):
states = ct.SolutionArray(self.gas, 10, extra={"index": range(10)})
for ix, state in enumerate(states):
assert state.index == ix

assert list(states[:2].index) == [0, 1]
assert list(states[100:102]) == [] # outside of range

def test_append_state(self):
gas = ct.Solution("h2o2.yaml")
gas.TPX = 300, ct.one_atm, 'H2:0.5, O2:0.4'
Expand Down

0 comments on commit 9c1651d

Please sign in to comment.