Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)'])
Exemplo n.º 6
0
 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)'])
Exemplo n.º 7
0
 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)'])
Exemplo n.º 8
0
 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)'])
Exemplo n.º 9
0
 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,)
Exemplo n.º 10
0
 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,
     )