diff --git a/interfaces/cython/cantera/composite.py b/interfaces/cython/cantera/composite.py index 79f2a781c6..1d0caa0861 100644 --- a/interfaces/cython/cantera/composite.py +++ b/interfaces/cython/cantera/composite.py @@ -195,6 +195,8 @@ class Quantity: >>> q3.P 101325.0 """ + __slots__ = ("state", "_phase", "_id", "mass", "constant") + def __init__(self, phase, mass=None, moles=None, constant='UV'): self.state = phase.TDY self._phase = phase diff --git a/interfaces/cython/cantera/test/test_thermo.py b/interfaces/cython/cantera/test/test_thermo.py index 6d5cbcd9a7..65bc5cedf1 100644 --- a/interfaces/cython/cantera/test/test_thermo.py +++ b/interfaces/cython/cantera/test/test_thermo.py @@ -1445,6 +1445,11 @@ def test_equilibrate(self): q1.equilibrate('HP') self.assertNear(q1.T, T2) + def test_invalid_setter(self): + q1 = ct.Quantity(self.gas, mass =3) + with self.assertRaises(AttributeError): + q1.HPQ = self.gas.H, self.gas.P, 1 + def test_incompatible(self): gas2 = ct.Solution('h2o2.yaml', transport_model=None) q1 = ct.Quantity(self.gas)