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

Method test_array_properties_exist

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

Source from the content-addressed store, hash-verified

2130 assert self.gas.mix_diff_coeffs == approx(Dkm[i,j,k])
2131
2132 def test_array_properties_exist(self):
2133 grid_shape = (7, 3)
2134 states = ct.SolutionArray(self.gas, grid_shape)
2135
2136 skip = {
2137 # Skipped because they are complicated (conversion not implemented)
2138 "forward_rates_of_progress_ddX", "net_rates_of_progress_ddX",
2139 "reverse_rates_of_progress_ddX", "state", "net_rates_of_progress_ddCi",
2140 "forward_rates_of_progress_ddCi", "reverse_rates_of_progress_ddCi"
2141 }
2142 skip.update(ct.SolutionArray._passthrough)
2143
2144 for attr in dir(self.gas):
2145 if attr.startswith("_") or attr in skip:
2146 continue
2147
2148 try:
2149 soln_value = getattr(self.gas, attr)
2150 except (ct.CanteraError, ct.ThermoModelMethodError, NotImplementedError):
2151 continue
2152
2153 if not isinstance(soln_value, (float, np.ndarray)):
2154 continue
2155
2156 assert hasattr(states, attr), attr
2157 array_value = getattr(states, attr)
2158 assert array_value.shape == grid_shape + np.asarray(soln_value).shape, attr
2159
2160 def test_slicing_onedim(self):
2161 states = ct.SolutionArray(self.gas, 5)

Callers

nothing calls this directly

Calls 2

SolutionArrayMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected