(self)
| 2357 | assert states.shape == (2,) |
| 2358 | |
| 2359 | def test_append_failures(self): |
| 2360 | states = ct.SolutionArray(self.gas, 5, extra={"prop": "value"}) |
| 2361 | states.TPX = np.linspace(500, 1000, 5), 2e5, 'H2:0.5, O2:0.4' |
| 2362 | assert states.shape == (5,) |
| 2363 | |
| 2364 | with pytest.raises(TypeError, match="Missing keyword arguments for extra"): |
| 2365 | states.append(T=1100, P=3e5, X="AR:1.0") |
| 2366 | # Failing to append a state shouldn't change the size |
| 2367 | assert states.shape == (5,) |
| 2368 | |
| 2369 | with pytest.raises(KeyError, match="does not specify"): |
| 2370 | # I is not a valid property |
| 2371 | states.append(TPI=(1100, 3e5, "AR:1.0"), prop="value2") |
| 2372 | # Failing to append a state shouldn't change the size |
| 2373 | assert states.shape == (5,) |
| 2374 | |
| 2375 | with pytest.raises(KeyError, match="is not a valid"): |
| 2376 | # I is not a valid property |
| 2377 | states.append(T=1100, P=3e5, I="AR:1.0", prop="value2") |
| 2378 | # Failing to append a state shouldn't change the size |
| 2379 | assert states.shape == (5,) |
| 2380 | |
| 2381 | with pytest.raises(ct.CanteraError, match="incompatible value"): |
| 2382 | # prop has incompatible dimensions |
| 2383 | states.append(T=1100, P=3e5, X="AR:1.0", prop=[1, 2, 3]) |
| 2384 | # Failing to append a state shouldn't change the size |
| 2385 | assert states.shape == (5,) |
| 2386 | |
| 2387 | states = ct.SolutionArray(self.gas, 1, extra={"prop": [1, 2, 3]}) |
| 2388 | with pytest.raises(ct.CanteraError, match="incompatible value"): |
| 2389 | # prop has incorrect type (no implicit conversion; changed from Cantera 2.6) |
| 2390 | states.append(T=1100, P=3e5, X="AR:1.0", prop=['a', 'b', 'c']) |
| 2391 | # Failing to append a state shouldn't change the size |
| 2392 | assert states.shape == (1,) |
| 2393 | |
| 2394 | states = ct.SolutionArray(self.gas, 1, extra={"prop": [1, 2, 3]}) |
| 2395 | with pytest.raises(ct.CanteraError, match="does not match"): |
| 2396 | # prop has incorrect dimensions |
| 2397 | states.append(T=1100, P=3e5, X="AR:1.0", prop=[1, 2]) |
| 2398 | # Failing to append a state shouldn't change the size |
| 2399 | assert states.shape == (1,) |
| 2400 | |
| 2401 | def test_purefluid(self): |
| 2402 | water = ct.Water() |
nothing calls this directly
no test coverage detected