Skip to content

Commit

Permalink
Merge branch 'tox-qsoptex' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jonls committed Jul 21, 2015
2 parents fff669d + 4dc536f commit 54e0a2b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ install: pip install tox
script: tox -v
env:
- TOXENV=py27-nosolver
- TOXENV=py27-qsoptex
- TOXENV=py34-nosolver
- TOXENV=py34-qsoptex
- TOXENV=docs
- TOXENV=flake
26 changes: 15 additions & 11 deletions psamm/tests/test_fastcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def test_lp7(self):

result = fastcore.lp7(self.model, {'rxn_5'}, 0.001, solver=self.solver)
supp = set(fastcore.support_positive(result, 0.001*0.999))
self.assertEqual(supp, { 'rxn_1', 'rxn_4', 'rxn_5', 'rxn_6' })
# Test that the support contains at least the given reactions
self.assertLessEqual({'rxn_4', 'rxn_5', 'rxn_6'}, supp)

def test_find_sparse_mode_singleton(self):
core = { 'rxn_1' }
Expand Down Expand Up @@ -168,9 +169,9 @@ class TestFastcoreTinyBiomassModel(unittest.TestCase):
fastcore.
In this particular model, rxn_2 can take a maximum flux of 1000. At the
same time rxn_1 will have to take a flux of 1e-4. This is the maximum
same time rxn_1 will have to take a flux of 1e-3. This is the maximum
possible flux for rxn_1 so running fastcore with an epsilon larger than
1e-4 will indicate that the model is not consistent.
1e-3 will indicate that the model is not consistent.
"""

def setUp(self):
Expand All @@ -189,18 +190,21 @@ def setUp(self):

def test_fastcc_is_consistent(self):
self.assertTrue(fastcore.fastcc_is_consistent(
self.model, 0.001, solver=self.solver))
self.model, 0.0001, solver=self.solver))

def test_fastcc_is_consistent_high_epsilon(self):
self.assertFalse(fastcore.fastcc_is_consistent(
self.model, 0.1, solver=self.solver))

def test_fastcore_induced_model(self):
core = { 'rxn_2' }
self.assertEquals(set(fastcore.fastcore(
self.model, core, 0.001, solver=self.solver)),
{ 'rxn_1', 'rxn_2' })
core = {'rxn_2'}
self.assertEqual(set(fastcore.fastcore(
self.model, core, 0.0001, solver=self.solver)), {'rxn_1', 'rxn_2'})

def test_fastcore_induced_model_high_epsilon(self):
core = { 'rxn_2' }
self.assertEquals(set(fastcore.fastcore(
self.model, core, 0.1, solver=self.solver)), { 'rxn_1', 'rxn_2' })
core = {'rxn_2'}
self.assertEqual(set(fastcore.fastcore(
self.model, core, 0.1, solver=self.solver)), {'rxn_1', 'rxn_2'})


class TestFlippingModel(unittest.TestCase):
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist =
py27-{nosolver,cplex},
py34-{nosolver},
py27-{nosolver,cplex,qsoptex},
py34-{nosolver,qsoptex},
coverage,
flake,
docs
Expand All @@ -14,9 +14,11 @@ exclude = psamm/tests
setenv =
nosolver: PSAMM_SOLVER=nosolver
cplex: PSAMM_SOLVER=cplex
qsoptex: PSAMM_SOLVER=qsoptex
deps =
coverage
cplex: {env:CPLEX_PYTHON_PACKAGE}
qsoptex: python-qsoptex
commands =
coverage run -p --branch --omit={envdir},psamm/tests \
./setup.py test
Expand Down

0 comments on commit 54e0a2b

Please sign in to comment.