Exemple #1
0
 def test_register_total_zero(self):
     cs = ChemSys()
     with pytest.raises(RuntimeError):
         cs.registerTotal("H", 0)
Exemple #2
0
 def test_register_total_pos(self):
     cs = ChemSys()
     cs.registerTotal("H", 1)
Exemple #3
0
 def test_register_rxn_superfluous(self):
     cs = ChemSys()
     cs.registerRxn("((H))+ = (H)+ , 0")
     assert True
Exemple #4
0
 def test_register_rxn_parens(self):
     cs = ChemSys()
     cs.registerRxn("((H(OH)2(H)))l = (H)+ , 0")
     assert True
Exemple #5
0
 def test_register_rxn_bad8(self):
     cs = ChemSys()
     with pytest.raises(RuntimeError):
         cs.registerRxn("((H)+ = (H)+ , 0")
Exemple #6
0
 def test_register_rxn_bad7(self):
     cs = ChemSys()
     with pytest.raises(RuntimeError):
         cs.registerRxn("H+ = H+ , 0")
Exemple #7
0
 def test_register_rxn_bad3(self):
     cs = ChemSys()
     with pytest.raises(ValueError):
         cs.registerRxn("(H)+ , 0")
Exemple #8
0
 def test_calcSimple(self):
     cs = ChemSys()
     cs.registerRxn("(T)aq = (H)+ , 0")
     (_, out, _) = calcSpec(cs)
     expect = [[10**(-x / 100) for x in range(0, 1401)]]
     assert out == expect
Exemple #9
0
import pytest
import filecmp
import os

from SpecGen.ChemSys import *
from SpecGen.Convert import *
from SpecGen.Calculations import *
from SpecGen.Plot import *

# systems for testing
emptySys = ChemSys()

feSys = ChemSys()
feSys.registerRxn("(Fe)3+ + (H2O)l = (Fe(OH))2+ + (H)+ , -2.19")
feSys.registerRxn("(Fe)3+ + 2(H2O)l = (Fe(OH)2)+ + 2(H)+ , -5.67")
feSys.registerRxn("(Fe)3+ + 4(H2O)l = (Fe(OH)4)- + 4(H)+ , -21.6")
feSys.registerTotal("Fe", 0.000010)

co3Sys = ChemSys()
co3Sys.registerRxn("(CO2)aq + (H2O)l = (H2CO3)aq , -2.77")
co3Sys.registerRxn("(H2CO3)aq = (HCO3)- + (H)+ , -3.6")
co3Sys.registerRxn("(HCO3)- = (CO3)2- + (H)+ , -10.33")
co3Sys.registerTotal("C", 0.000010)


###########################
# Plotting module testing #
###########################
class TestPlot(object):

    # test plotting line vs known diagram