Skip to content

Commit

Permalink
#29: Test bracket access functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkraft committed May 9, 2018
1 parent a0f9b57 commit 37eb074
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/solute_access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import cmf
import unittest


class TestSoluteAccess(unittest.TestCase):
def testConc(self):
p = cmf.project('X Y Z')
X, Y, Z = p.solutes
ws = p.NewStorage('storage')
self.assertEqual(repr(ws[X]), '{storage}[X]')
self.assertEqual(ws.conc(X), ws[X].conc)

def testState(self):
p = cmf.project('X Y Z')
X, Y, Z = p.solutes
ws = p.NewStorage('storage')
ws.volume = 1.0
ws[X].state = 1.0
ws.volume = 2.0
self.assertAlmostEquals(ws[X].conc, 0.5)
self.assertAlmostEquals(ws[X].state, 1.0)
self.assertAlmostEquals(ws[Y].conc, 0.0)

0 comments on commit 37eb074

Please sign in to comment.