Skip to content

Commit

Permalink
implement unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdanielmachado committed Oct 16, 2019
1 parent 57b47f0 commit 16570b3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 196 deletions.
172 changes: 0 additions & 172 deletions tests/data/media_db.tsv
Original file line number Diff line number Diff line change
@@ -1,73 +1,4 @@
medium description compound name
RICH LB plus other carbon sources adn Adenosine
RICH LB plus other carbon sources ala__L L-Alanine
RICH LB plus other carbon sources amp AMP
RICH LB plus other carbon sources arg__L L-Arginine
RICH LB plus other carbon sources aso3 Arsenite 
RICH LB plus other carbon sources asp__L L-Aspartate
RICH LB plus other carbon sources ca2 Ca2+
RICH LB plus other carbon sources cbl1 Vitamin B12
RICH LB plus other carbon sources cd2 Cadmium 
RICH LB plus other carbon sources cl Cl-
RICH LB plus other carbon sources cmp CMP
RICH LB plus other carbon sources cobalt2 Co2+
RICH LB plus other carbon sources cro4 Chromate 
RICH LB plus other carbon sources cu2 Cu2+
RICH LB plus other carbon sources cys__L L-Cysteine
RICH LB plus other carbon sources dad_2 Deoxyadenosine 
RICH LB plus other carbon sources dcyt Deoxycytidine
RICH LB plus other carbon sources fe2 Fe2+
RICH LB plus other carbon sources fe3 Fe3+
RICH LB plus other carbon sources fol Folate
RICH LB plus other carbon sources glc__D D-Glucose
RICH LB plus other carbon sources glu__L L-Glutamate
RICH LB plus other carbon sources gly Glycine
RICH LB plus other carbon sources gmp GMP
RICH LB plus other carbon sources gsn Guanosine
RICH LB plus other carbon sources h2o H2O
RICH LB plus other carbon sources h2s Hydrogen sulfide
RICH LB plus other carbon sources h H+
RICH LB plus other carbon sources hg2 Hg2+ 
RICH LB plus other carbon sources his__L L-Histidine
RICH LB plus other carbon sources hxan Hypoxanthine
RICH LB plus other carbon sources ile__L L-Isoleucine
RICH LB plus other carbon sources ins Inosine
RICH LB plus other carbon sources k K+
RICH LB plus other carbon sources leu__L L-Leucine
RICH LB plus other carbon sources lipoate Lipoate
RICH LB plus other carbon sources lys__L L-Lysine
RICH LB plus other carbon sources met__L L-Methionine
RICH LB plus other carbon sources mg2 Mg
RICH LB plus other carbon sources mn2 Mn2+
RICH LB plus other carbon sources mobd Molybdate
RICH LB plus other carbon sources na1 Na+
RICH LB plus other carbon sources nac Isonicotinic acid
RICH LB plus other carbon sources nh4 Ammonium
RICH LB plus other carbon sources ni2 Ni2+
RICH LB plus other carbon sources o2 O2
RICH LB plus other carbon sources phe__L L-Phenylalanine
RICH LB plus other carbon sources pheme Protoheme
RICH LB plus other carbon sources pi Phosphate
RICH LB plus other carbon sources pnto__R PAN
RICH LB plus other carbon sources pro__L L-Proline
RICH LB plus other carbon sources pydx Pyridoxal
RICH LB plus other carbon sources ribflv Riboflavin
RICH LB plus other carbon sources ser__L L-Serine
RICH LB plus other carbon sources so4 Sulfate
RICH LB plus other carbon sources thm Thiamin
RICH LB plus other carbon sources thr__L L-Threonine
RICH LB plus other carbon sources thymd Thymidine
RICH LB plus other carbon sources trp__L L-Tryptophan
RICH LB plus other carbon sources tyr__L L-Tyrosine
RICH LB plus other carbon sources ump UMP
RICH LB plus other carbon sources ura Uracil
RICH LB plus other carbon sources uri Uridine
RICH LB plus other carbon sources val__L L-Valine
RICH LB plus other carbon sources zn2 Zn2+
RICH LB plus other carbon sources ac acetate
RICH LB plus other carbon sources etoh ethanol
RICH LB plus other carbon sources lac__D lactate
RICH LB plus other carbon sources pyr pyruvate
LB Lysogeny broth adn Adenosine
LB Lysogeny broth ala__L L-Alanine
LB Lysogeny broth amp AMP
Expand Down Expand Up @@ -133,70 +64,6 @@ LB Lysogeny broth ura Uracil
LB Lysogeny broth uri Uridine
LB Lysogeny broth val__L L-Valine
LB Lysogeny broth zn2 Zn2+
LB[-O2] Lysogeny broth (anaerobic) adn Adenosine
LB[-O2] Lysogeny broth (anaerobic) ala__L L-Alanine
LB[-O2] Lysogeny broth (anaerobic) amp AMP
LB[-O2] Lysogeny broth (anaerobic) arg__L L-Arginine
LB[-O2] Lysogeny broth (anaerobic) aso3 Arsenite 
LB[-O2] Lysogeny broth (anaerobic) asp__L L-Aspartate
LB[-O2] Lysogeny broth (anaerobic) ca2 Ca2+
LB[-O2] Lysogeny broth (anaerobic) cbl1 Vitamin B12
LB[-O2] Lysogeny broth (anaerobic) cd2 Cadmium 
LB[-O2] Lysogeny broth (anaerobic) cl Cl-
LB[-O2] Lysogeny broth (anaerobic) cmp CMP
LB[-O2] Lysogeny broth (anaerobic) cobalt2 Co2+
LB[-O2] Lysogeny broth (anaerobic) cro4 Chromate 
LB[-O2] Lysogeny broth (anaerobic) cu2 Cu2+
LB[-O2] Lysogeny broth (anaerobic) cys__L L-Cysteine
LB[-O2] Lysogeny broth (anaerobic) dad_2 Deoxyadenosine 
LB[-O2] Lysogeny broth (anaerobic) dcyt Deoxycytidine
LB[-O2] Lysogeny broth (anaerobic) fe2 Fe2+
LB[-O2] Lysogeny broth (anaerobic) fe3 Fe3+
LB[-O2] Lysogeny broth (anaerobic) fol Folate
LB[-O2] Lysogeny broth (anaerobic) glc__D D-Glucose
LB[-O2] Lysogeny broth (anaerobic) glu__L L-Glutamate
LB[-O2] Lysogeny broth (anaerobic) gly Glycine
LB[-O2] Lysogeny broth (anaerobic) gmp GMP
LB[-O2] Lysogeny broth (anaerobic) gsn Guanosine
LB[-O2] Lysogeny broth (anaerobic) h2o H2O
LB[-O2] Lysogeny broth (anaerobic) h2s Hydrogen sulfide
LB[-O2] Lysogeny broth (anaerobic) h H+
LB[-O2] Lysogeny broth (anaerobic) hg2 Hg2+ 
LB[-O2] Lysogeny broth (anaerobic) his__L L-Histidine
LB[-O2] Lysogeny broth (anaerobic) hxan Hypoxanthine
LB[-O2] Lysogeny broth (anaerobic) ile__L L-Isoleucine
LB[-O2] Lysogeny broth (anaerobic) ins Inosine
LB[-O2] Lysogeny broth (anaerobic) k K+
LB[-O2] Lysogeny broth (anaerobic) leu__L L-Leucine
LB[-O2] Lysogeny broth (anaerobic) lipoate Lipoate
LB[-O2] Lysogeny broth (anaerobic) lys__L L-Lysine
LB[-O2] Lysogeny broth (anaerobic) met__L L-Methionine
LB[-O2] Lysogeny broth (anaerobic) mg2 Mg
LB[-O2] Lysogeny broth (anaerobic) mn2 Mn2+
LB[-O2] Lysogeny broth (anaerobic) mobd Molybdate
LB[-O2] Lysogeny broth (anaerobic) na1 Na+
LB[-O2] Lysogeny broth (anaerobic) nac Isonicotinic acid
LB[-O2] Lysogeny broth (anaerobic) nh4 Ammonium
LB[-O2] Lysogeny broth (anaerobic) ni2 Ni2+
LB[-O2] Lysogeny broth (anaerobic) phe__L L-Phenylalanine
LB[-O2] Lysogeny broth (anaerobic) pheme Protoheme
LB[-O2] Lysogeny broth (anaerobic) pi Phosphate
LB[-O2] Lysogeny broth (anaerobic) pnto__R PAN
LB[-O2] Lysogeny broth (anaerobic) pro__L L-Proline
LB[-O2] Lysogeny broth (anaerobic) pydx Pyridoxal
LB[-O2] Lysogeny broth (anaerobic) ribflv Riboflavin
LB[-O2] Lysogeny broth (anaerobic) ser__L L-Serine
LB[-O2] Lysogeny broth (anaerobic) so4 Sulfate
LB[-O2] Lysogeny broth (anaerobic) thm Thiamin
LB[-O2] Lysogeny broth (anaerobic) thr__L L-Threonine
LB[-O2] Lysogeny broth (anaerobic) thymd Thymidine
LB[-O2] Lysogeny broth (anaerobic) trp__L L-Tryptophan
LB[-O2] Lysogeny broth (anaerobic) tyr__L L-Tyrosine
LB[-O2] Lysogeny broth (anaerobic) ump UMP
LB[-O2] Lysogeny broth (anaerobic) ura Uracil
LB[-O2] Lysogeny broth (anaerobic) uri Uridine
LB[-O2] Lysogeny broth (anaerobic) val__L L-Valine
LB[-O2] Lysogeny broth (anaerobic) zn2 Zn2+
M9 M9 minimal medium ca2 Ca2+
M9 M9 minimal medium cl Cl-
M9 M9 minimal medium cobalt2 Co2+
Expand All @@ -217,42 +84,3 @@ M9 M9 minimal medium o2 O2
M9 M9 minimal medium pi Phosphate
M9 M9 minimal medium so4 Sulfate
M9 M9 minimal medium zn2 Zn2+
M9[-O2] M9 minimal medium (anaerobic) ca2 Ca2+
M9[-O2] M9 minimal medium (anaerobic) cl Cl-
M9[-O2] M9 minimal medium (anaerobic) cobalt2 Co2+
M9[-O2] M9 minimal medium (anaerobic) cu2 Cu2+
M9[-O2] M9 minimal medium (anaerobic) fe2 Fe2+
M9[-O2] M9 minimal medium (anaerobic) fe3 Fe3+
M9[-O2] M9 minimal medium (anaerobic) glc__D D-Glucose
M9[-O2] M9 minimal medium (anaerobic) h2o H2O
M9[-O2] M9 minimal medium (anaerobic) h H+
M9[-O2] M9 minimal medium (anaerobic) k K+
M9[-O2] M9 minimal medium (anaerobic) mg2 Mg
M9[-O2] M9 minimal medium (anaerobic) mn2 Mn2+
M9[-O2] M9 minimal medium (anaerobic) mobd Molybdate
M9[-O2] M9 minimal medium (anaerobic) na1 Na+
M9[-O2] M9 minimal medium (anaerobic) nh4 Ammonium
M9[-O2] M9 minimal medium (anaerobic) ni2 Ni2+
M9[-O2] M9 minimal medium (anaerobic) pi Phosphate
M9[-O2] M9 minimal medium (anaerobic) so4 Sulfate
M9[-O2] M9 minimal medium (anaerobic) zn2 Zn2+
M9[glyc] M9 minimal medium (glycerol) ca2 Ca2+
M9[glyc] M9 minimal medium (glycerol) cl Cl-
M9[glyc] M9 minimal medium (glycerol) cobalt2 Co2+
M9[glyc] M9 minimal medium (glycerol) cu2 Cu2+
M9[glyc] M9 minimal medium (glycerol) fe2 Fe2+
M9[glyc] M9 minimal medium (glycerol) fe3 Fe3+
M9[glyc] M9 minimal medium (glycerol) glyc Glycerol
M9[glyc] M9 minimal medium (glycerol) h2o H2O
M9[glyc] M9 minimal medium (glycerol) h H+
M9[glyc] M9 minimal medium (glycerol) k K+
M9[glyc] M9 minimal medium (glycerol) mg2 Mg
M9[glyc] M9 minimal medium (glycerol) mn2 Mn2+
M9[glyc] M9 minimal medium (glycerol) mobd Molybdate
M9[glyc] M9 minimal medium (glycerol) na1 Na+
M9[glyc] M9 minimal medium (glycerol) nh4 Ammonium
M9[glyc] M9 minimal medium (glycerol) ni2 Ni2+
M9[glyc] M9 minimal medium (glycerol) o2 O2
M9[glyc] M9 minimal medium (glycerol) pi Phosphate
M9[glyc] M9 minimal medium (glycerol) so4 Sulfate
M9[glyc] M9 minimal medium (glycerol) zn2 Zn2+
12 changes: 12 additions & 0 deletions tests/output/test_detailed.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
community medium receiver donor compound scs mus mps smetana
all M9 ec_glc_ko ec_nh4_ko M_ac_e 1.0 0.11 1 0.11
all M9 ec_glc_ko ec_nh4_ko M_acald_e 1.0 0.28 1 0.28
all M9 ec_glc_ko ec_nh4_ko M_akg_e 1.0 0.25 1 0.25
all M9 ec_glc_ko ec_nh4_ko M_co2_e 1.0 0.02 1 0.02
all M9 ec_glc_ko ec_nh4_ko M_etoh_e 1.0 0.31 1 0.31
all M9 ec_glc_ko ec_nh4_ko M_lac__D_e 1.0 0.37 1 0.37
all M9 ec_glc_ko ec_nh4_ko M_pyr_e 1.0 0.24 1 0.24
all M9 ec_glc_ko ec_nh4_ko M_succ_e 1.0 0.09 1 0.09
all M9 ec_nh4_ko ec_glc_ko M_glu__L_e 1.0 1.0 1 1.0
all M9 ec_nh4_ko ec_glc_ko M_lac__D_e 1.0 0.08333333333333333 1 0.08333333333333333
all M9 ec_nh4_ko ec_glc_ko M_pyr_e 1.0 0.08333333333333333 1 0.08333333333333333
3 changes: 3 additions & 0 deletions tests/output/test_global.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
community medium size mip mro
all M9 2 n/a 0.0
all LB 2 1 0.8
37 changes: 13 additions & 24 deletions tests/test_smetana.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,22 @@
# -*- coding: utf-8 -*-

import unittest
from smetana.interface import main
import pandas as pd


class TestMIP(unittest.TestCase):
"""Test SBML import / export."""

def setUp(self):
pass

def test_mip(self):
raise NotImplementedError("Unit tests are not yet implemented.")


class TestMRO(unittest.TestCase):
"""Test SBML import / export."""

def setUp(self):
pass

def test_mro(self):
raise NotImplementedError("Unit tests are not yet implemented.")
class TestGlobal(unittest.TestCase):
def test_global(self):
main(["tests/data/ec_*_ko.xml"], mode="global", output="tests/output/test", media="M9,LB",
mediadb="tests/data/media_db.tsv", ext_comp_id="e", exclude="tests/data/inorganic.txt")
df = pd.read_csv("tests/output/test_global.tsv")
self.assertEqual(df.shape[0], 2)


class TestDetailed(unittest.TestCase):
"""Test SBML import / export."""

def setUp(self):
pass

def test_global(self):
raise NotImplementedError("Unit tests are not yet implemented.")
def test_detailed(self):
main(["tests/data/ec_*.xml"], mode="detailed", output="tests/output/test", media="M9,LB",
mediadb="tests/data/media_db.tsv", ext_comp_id="e", exclude="tests/data/inorganic.txt")
df = pd.read_csv("tests/output/test_detailed.tsv")
self.assertEqual(df.shape[0], 11)
12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tox]
envlist = py36

[travis]
python =
3.6: py36

[testenv]
setenv =
PYTHONPATH = {toxinidir}

commands = python setup.py test

0 comments on commit 16570b3

Please sign in to comment.