MCPcopy Create free account
hub / github.com/Cantera/cantera / test_extra_no_shape

Method test_extra_no_shape

test/python/test_thermo.py:2213–2223  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2211 assert states.grid == approx(np.arange(10))
2212
2213 def test_extra_no_shape(self):
2214 # The shape of the value for "prop" here is (), which is falsey
2215 # and causes the use of np.full()
2216 states = ct.SolutionArray(self.gas, 3, extra={"prop": 1})
2217 assert states.prop.shape == (3,)
2218 assert states.prop == approx(np.array((1, 1, 1)))
2219
2220 # Check a multidimensional SolutionArray
2221 states = ct.SolutionArray(self.gas, (2, 2), extra={"prop": 3})
2222 assert states.prop.shape == (2, 2)
2223 assert states.prop == approx(np.array(((3, 3), (3, 3))))
2224
2225 def test_extra_not_empty(self):
2226 """Test that a non-empty SolutionArray raises a ValueError if

Callers

nothing calls this directly

Calls 1

SolutionArrayMethod · 0.80

Tested by

no test coverage detected