[Python] Add Reaction.__contains__ method
This commit is contained in:
parent
4c5301d6cd
commit
2bfbd73a12
2 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue