def setUp(self): self.compound1 = Compound({ "a1": "H", "a2": "O" }, {"b1": ("a1", "a2", { 'order': 1, 'chirality': None })}, {"id": "Hydroxide"}) self.compound2 = Compound({ "a1": "H", "a2": "H", "a3": "O", "a4": "H" }, { "b1": ("a1", "a3", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }), "b3": ("a3", "a4", { 'order': 1, 'chirality': None }) }, {"id": "Hydronium"}) self.acid1 = Acid(self.compound2, 'a1', -1.74) self.base1 = Base(self.compound1, 'a2', 16)
def setUp(self): self.compound1 = Compound( {"a1":"H", "a2":"O"}, {"b1":("a1", "a2", {'order': 1, 'chirality': None})}, {"id":"Hydroxide"}) self.compound2 = Compound( {"a1":"H", "a2":"H", "a3":"O", "a4":"H"}, {"b1":("a1", "a3", {'order': 1, 'chirality': None}), "b2":("a2", "a3", {'order': 1, 'chirality': None}), "b3":("a3", "a4", {'order': 1, 'chirality': None})}, {"id":"Hydronium"}) self.compound3 = Compound( {'a1':'H', 'a2':'O', 'a3':'H'}, {'b1':('a1', 'a2', {'order':1, 'chirality':None}), 'b2':('a2', 'a3', {'order':1, 'chirality':None})}, {'id':"Water"}) self.acid = Acid(self.compound2, 'a1', -1.74) self.base = Base(self.compound1, 'a2', 16) self.conj_acid = Acid(self.compound3, 'a3', 16) self.conditions = Conditions({})
class TestBase(unittest.TestCase): def setUp(self): self.compound1 = Compound( {"a1":"H", "a2":"O"}, {"b1":("a1", "a2", {'order': 1, 'chirality': None})}, {"id":"Hydroxide"}) self.compound2 = Compound( {"a1":"H", "a2":"H", "a3":"O", "a4":"H"}, {"b1":("a1", "a3", {'order': 1, 'chirality': None}), "b2":("a2", "a3", {'order': 1, 'chirality': None}), "b3":("a3", "a4", {'order': 1, 'chirality': None})}, {"id":"Hydronium"}) self.compound3 = Compound( {'a1':'H', 'a2':'O', 'a3':'H'}, {'b1':('a1', 'a2', {'order':1, 'chirality':None}), 'b2':('a2', 'a3', {'order':1, 'chirality':None})}, {'id':"Water"}) self.acid = Acid(self.compound2, 'a1', -1.74) self.base = Base(self.compound1, 'a2', 16) self.conj_acid = Acid(self.compound3, 'a3', 16) self.conditions = Conditions({}) def test_to_conjugate_Acid(self): self.assertEqual(self.base.to_conjugate_acid(), self.conj_acid)
def setUp(self): self.compound1 = Compound({ "a1": "H", "a2": "O" }, {"b1": ("a1", "a2", { 'order': 1, 'chirality': None })}, {"id": "Hydroxide"}) self.compound2 = Compound({ "a1": "H", "a2": "H", "a3": "O", "a4": "H" }, { "b1": ("a1", "a3", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }), "b3": ("a3", "a4", { 'order': 1, 'chirality': None }) }, {"id": "Hydronium"}) self.compound3 = Compound({ 'a1': 'H', 'a2': 'O', 'a3': 'H' }, { 'b1': ('a1', 'a2', { 'order': 1, 'chirality': None }), 'b2': ('a2', 'a3', { 'order': 1, 'chirality': None }) }, {'id': "Water"}) self.acid = Acid(self.compound2, 'a1', -1.74) self.base = Base(self.compound1, 'a2', 16) self.conj_acid = Acid(self.compound3, 'a3', 16) self.conditions = Conditions({})
def test_reactions(self): """Tests the reactions to determine which will come to fruition""" self.successful_reactions = [] for reaction in self.reactionlist: testing_reaction = reaction(Acid(self.compound[0], 'a1', -1.74), Base(self.compound[1], 'a3', 16), self.conditions) print testing_reaction._acid print testing_reaction._conditions print testing_reaction._base
class TestBase(unittest.TestCase): def setUp(self): self.compound1 = Compound({ "a1": "H", "a2": "O" }, {"b1": ("a1", "a2", { 'order': 1, 'chirality': None })}, {"id": "Hydroxide"}) self.compound2 = Compound({ "a1": "H", "a2": "H", "a3": "O", "a4": "H" }, { "b1": ("a1", "a3", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }), "b3": ("a3", "a4", { 'order': 1, 'chirality': None }) }, {"id": "Hydronium"}) self.compound3 = Compound({ 'a1': 'H', 'a2': 'O', 'a3': 'H' }, { 'b1': ('a1', 'a2', { 'order': 1, 'chirality': None }), 'b2': ('a2', 'a3', { 'order': 1, 'chirality': None }) }, {'id': "Water"}) self.acid = Acid(self.compound2, 'a1', -1.74) self.base = Base(self.compound1, 'a2', 16) self.conj_acid = Acid(self.compound3, 'a3', 16) self.conditions = Conditions({}) def test_to_conjugate_Acid(self): self.assertEqual(self.base.to_conjugate_acid(), self.conj_acid)
def setUp(self): self.compound1 = compounds.Compound({ "a1": "H", "a2": "H", "a3": "O" }, { "b1": ("a1", "a3", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }) }, {"id": "Water"}) self.compound2 = compounds.Compound( { "a1": "H", "a2": "H", "a3": "O", "a4": "H" }, { "b1": ("a1", "a3", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }), "b3": ("a3", "a4", { 'order': 1, 'chirality': None }) }, {"id": "Hydronium"}) self.acid1 = Acid(self.compound2, 'a1', -1.74) self.base1 = Base(self.compound1, 'a2', -1.74) self.conditions1 = Conditions({}) self.acidbase1 = AcidBase(self.acid1, self.base1, self.conditions1) self.hydroiodic = Acid( compounds.Compound({ "a1": "H", "a2": "I" }, {"b1": ("a1", "a2", { 'order': 1, 'chirality': None })}, {"id": "Hydroiodic acid"}), 'a1', -10) self.conditions2 = Conditions({ 'pka': -10, 'acidic': True, 'pka_molecule': self.hydroiodic, 'pka_location': 'a1' }) self.acidbase2 = AcidBase(self.acid1, self.base1, self.conditions2) self.hydroxide = Base( compounds.Compound({ "a1": "H", "a2": "O", "a3": "Na" }, { "b1": ("a1", "a2", { 'order': 1, 'chirality': None }), "b2": ("a2", "a3", { 'order': 1, 'chirality': None }) }, {"id": "Sodium Hydroxide"}), 'a2', 15.7) self.conditions3 = Conditions({ 'pka': 15.7, 'basic': True, 'pka_molecule': self.hydroxide, 'pka_location': 'a2' }) self.acidbase3 = AcidBase(self.acid1, self.base1, self.conditions3)