Commit dbcfb54c authored by eladnoor's avatar eladnoor

flake8 and isort

parent 247fd884
......@@ -31,10 +31,9 @@ import pandas as pd
import pkg_resources
from numpy import log
from . import Q_, Compound, ccache, standard_concentration, ureg
from .settings import default_conc_lb, default_conc_ub
from . import Q_, Compound, ccache, ureg, standard_concentration
class InvalidBounds(Exception):
pass
......
......@@ -30,9 +30,9 @@ from typing import Dict, List, Tuple
import numpy as np
from component_contribution import GibbsEnergyPredictor
from . import Compound, ureg
from . import (
FARADAY, Compound, R, default_I, default_pH, default_pMg, default_T, ureg)
from .phased_reaction import PhasedReaction
from . import FARADAY, R, default_I, default_pH, default_pMg, default_T
class ComponentContribution(object):
......
......@@ -37,12 +37,10 @@ from equilibrator_cache.reaction import (
from sbtab import SBtab
from scipy.linalg import fractional_matrix_power
from . import Compound
from . import Q_, Compound, R, default_I, default_pH, default_pMg, default_T
from .bounds import Bounds
from .component_contribution import ComponentContribution
from .phased_reaction import PhasedReaction
from . import (
Q_, R, default_I, default_pH, default_pMg, default_T)
from .settings import strip_units
from .thermo_models import PathwayThermoModel
......
......@@ -28,6 +28,7 @@ import numpy as np
from . import Q_
default_pMg = Q_("14.0")
default_phase = 'aqueous'
default_conc_lb = Q_("1e-6 M")
......
......@@ -39,6 +39,7 @@ from . import approx_unit
warnings.simplefilter('error', UserWarning)
@pytest.fixture(scope="module")
def toy_pathway() -> Pathway:
test_dir = os.path.dirname(
......@@ -46,6 +47,7 @@ def toy_pathway() -> Pathway:
sbtab = SBtab.read_csv(os.path.join(test_dir, 'pathway.tsv'), "pathway")
return Pathway.from_sbtab(sbtab)
def test_shadow_prices(toy_pathway):
warnings.simplefilter('ignore', ResourceWarning)
......@@ -76,9 +78,10 @@ def test_shadow_prices(toy_pathway):
try:
mdf_data.reaction_plot
mdf_data.compound_plot
except:
except Exception:
pytest.fail("MDF plot function raises exception")
@pytest.mark.parametrize(
"p_h, ionic_strength, stdev_factor, expected_mdf",
[
......
......@@ -38,13 +38,15 @@ from . import approx_unit
@pytest.fixture(scope="module")
def comp_contribution() -> ComponentContribution:
return ComponentContribution(p_h = Q_("7"), ionic_strength = Q_("0.25M"))
return ComponentContribution(p_h=Q_("7"), ionic_strength=Q_("0.25M"))
@pytest.fixture(scope="module")
def atp_hydrolysis() -> Reaction:
formula = "KEGG:C00002 + KEGG:C00001 = KEGG:C00008 + KEGG:C00009"
return Reaction.parse_formula(formula)
@pytest.fixture(scope="module")
def fermentation_gas() -> Reaction:
formula = "KEGG:C00031 = 2 KEGG:C00469 + 2 KEGG:C00011"
......@@ -52,6 +54,7 @@ def fermentation_gas() -> Reaction:
rxn.change_phase(ccache.get_compound("KEGG:C00011"), GAS_PHASE)
return rxn
def test_atp_hydrolysis_physiological_dg(comp_contribution, atp_hydrolysis):
warnings.simplefilter('ignore', ResourceWarning)
assert atp_hydrolysis.is_balanced()
......@@ -66,11 +69,13 @@ def test_atp_hydrolysis_physiological_dg(comp_contribution, atp_hydrolysis):
assert float(atp_hydrolysis.dg_correction(compound_to_conc)) == \
pytest.approx(numpy.log(1e-6), rel=1e-3)
def test_fermentation_gas(comp_contribution, fermentation_gas):
assert fermentation_gas.is_balanced()
assert float(fermentation_gas.physiological_dg_correction()) == \
pytest.approx(numpy.log(1e-9), rel=1e-3)
def test_atp_hydrolysis_dg(comp_contribution, atp_hydrolysis):
warnings.simplefilter('ignore', ResourceWarning)
......@@ -126,7 +131,8 @@ def test_reduction_potential(comp_contribution):
def test_unresolved_reactions(comp_contribution):
formula = "KEGG:C09844 + KEGG:C00003 + KEGG:C00001 => KEGG:C03092 + KEGG:C00004"
formula = ("KEGG:C09844 + KEGG:C00003 + KEGG:C00001 => "
"KEGG:C03092 + KEGG:C00004")
reaction = Reaction.parse_formula(formula)
_, dg_uncertainty = comp_contribution.standard_dg_prime(reaction)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment