def testSulfuricAcidNoReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() H2SO4 = Molecule("H2SO4(aq)", space, batch) NaCl = Molecule("NaCl(s)", space, batch) H2SO4.creation_time = 0 NaCl.creation_time = 0 collisions = createCollisionsMock(H2SO4, NaCl) reaction = level1.react(collisions, []) self.assertEqual(reaction, None)
def testGetCollidingMolecules(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() OH = Molecule("OH-(aq)", space, batch) H = Molecule("H+(g)", space, batch) OH.creation_time = 0 H.creation_time = 0 collisions = createCollisionsMock(OH, H) collidingMolecules = level1.get_colliding_molecules(collisions) self.assertEqual([OH, H], collidingMolecules)
def testSulfuricAcidNoReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() H2SO4 = Molecule("H2SO4(aq)", space, batch) NaCl = Molecule("NaCl(s)", space, batch) H2SO4.creation_time = 0 NaCl.creation_time = 0 collisions = createCollisionsMock(H2SO4, NaCl) reaction = level1.react(collisions,[]) self.assertEqual(reaction, None)
def testSulfuricAcidReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() H2SO4 = Molecule("H2SO4(aq)", space, batch) NaCl = Molecule("NaCl(s)", space, batch) NaCl_ = Molecule("NaCl(s)", space, batch) H2SO4.creation_time = 0 NaCl.creation_time = 0 NaCl_.creation_time = 0 collisions = createCollisionsMock(H2SO4, NaCl, NaCl_) reaction = level1.react(collisions,[]) self.assertEqual(reaction.reactants, ['H2SO4(aq)', 'NaCl(s)', 'NaCl(s)']) self.assertEqual(reaction.products, ['HCl(g)', 'HCl(g)', 'Na2SO4(s)'])
def testSulfuricAcidReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() H2SO4 = Molecule("H2SO4(aq)", space, batch) NaCl = Molecule("NaCl(s)", space, batch) NaCl_ = Molecule("NaCl(s)", space, batch) H2SO4.creation_time = 0 NaCl.creation_time = 0 NaCl_.creation_time = 0 collisions = createCollisionsMock(H2SO4, NaCl, NaCl_) reaction = level1.react(collisions, []) self.assertEqual(reaction.reactants, ['H2SO4(aq)', 'NaCl(s)', 'NaCl(s)']) self.assertEqual(reaction.products, ['HCl(g)', 'HCl(g)', 'Na2SO4(s)'])
def testCollisionReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() OH = Molecule("OH-(aq)", space, batch) Al = Molecule("Al(s)", space, batch) H = Molecule("H+(g)", space, batch) H_ = Molecule("H+(g)", space, batch) OH.creation_time = 0 Al.creation_time = 0 H.creation_time = 0 H_.creation_time = 0 collisions = createCollisionsMock(OH, Al, H, H_) reaction = level1.react(collisions, []) self.assertEqual(reaction.reactants, ['H+(g)', 'H+(g)']) self.assertEqual(reaction.products, ['H2(g)'])
def testCollisionReaction(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() OH = Molecule("OH-(aq)", space, batch) Al = Molecule("Al(s)", space, batch) H = Molecule("H+(g)", space, batch) H_ = Molecule("H+(g)", space, batch) OH.creation_time = 0 Al.creation_time = 0 H.creation_time = 0 H_.creation_time = 0 collisions = createCollisionsMock(OH, Al, H, H_) reaction = level1.react(collisions,[]) self.assertEqual(reaction.reactants, ['H+(g)', 'H+(g)']) self.assertEqual(reaction.products, ['H2(g)'])
def testGetReactingMolecules(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() OH = Molecule("OH-(aq)", space, batch) Al = Molecule("Al(s)", space, batch) H = Molecule("H+(g)", space, batch) H_ = Molecule("H+(g)", space, batch) OH.creation_time = 0 Al.creation_time = 0 H.creation_time = 0 H_.creation_time = 0 collisions = createCollisionsMock(OH, Al, H, H_) reaction = setupSimpleReactor().react([H.state_formula,OH.state_formula]) reactingMolecules = level1.get_molecules_in_reaction(collisions, reaction) self.assertEqual([OH, H], reactingMolecules,)
def testGetReactingMolecules(self): level1 = getLevel1() space, batch = createSpaceAndBatchMock() OH = Molecule("OH-(aq)", space, batch) Al = Molecule("Al(s)", space, batch) H = Molecule("H+(g)", space, batch) H_ = Molecule("H+(g)", space, batch) OH.creation_time = 0 Al.creation_time = 0 H.creation_time = 0 H_.creation_time = 0 collisions = createCollisionsMock(OH, Al, H, H_) reaction = setupSimpleReactor().react( [H.state_formula, OH.state_formula]) reactingMolecules = level1.get_molecules_in_reaction( collisions, reaction) self.assertEqual( [OH, H], reactingMolecules, )