diff --git a/interfaces/cython/cantera/reaction.pyx b/interfaces/cython/cantera/reaction.pyx index 1b1e8f8eb..d9a4f720a 100644 --- a/interfaces/cython/cantera/reaction.pyx +++ b/interfaces/cython/cantera/reaction.pyx @@ -161,6 +161,9 @@ cdef class Reaction: def __set__(self, products): self.reaction.products = comp_map(products) + def __contains__(self, species): + return species in self.reactants or species in self.products + property orders: """ Get/Set the reaction order with respect to specific species as a dict diff --git a/interfaces/cython/cantera/test/test_kinetics.py b/interfaces/cython/cantera/test/test_kinetics.py index c6bcecda8..ca9437f59 100644 --- a/interfaces/cython/cantera/test/test_kinetics.py +++ b/interfaces/cython/cantera/test/test_kinetics.py @@ -613,6 +613,9 @@ class TestReaction(utilities.CanteraTest): self.assertEqual(r.products['O2'], 1) self.assertEqual(r.efficiencies['H2O'], 15.4) self.assertEqual(r.rate.temperature_exponent, -1.0) + self.assertIn('O', r) + self.assertIn('O2', r) + self.assertNotIn('H2O', r) def test_fromXml(self): import xml.etree.ElementTree as ET