def test_validate_mass_balance(self, model): assert len(check_mass_balance(model)) == 0 # if we remove the SBO term which marks the reaction as # mass balanced, then the reaction should be detected as # no longer mass balanced EX_rxn = model.reactions.query("EX")[0] EX_rxn.annotation.pop("SBO") balance = check_mass_balance(model) assert len(balance) == 1 assert EX_rxn in balance m1 = Metabolite('m1', formula='()') r1 = Reaction('r1') r1.add_metabolites({m1: 1}) with pytest.raises(ValueError): r1.check_mass_balance()
def test_validate_mass_balance(self, model): assert len(check_mass_balance(model)) == 0 # if we remove the SBO term which marks the reaction as # mass balanced, then the reaction should be detected as # no longer mass balanced EX_rxn = model.reactions.query(lambda r: r.boundary)[0] EX_rxn.annotation.pop("SBO") balance = check_mass_balance(model) assert len(balance) == 1 assert EX_rxn in balance m1 = Metabolite('m1', formula='()') r1 = Reaction('r1') r1.add_metabolites({m1: 1}) with pytest.raises(ValueError), pytest.warns(UserWarning): r1.check_mass_balance()
def test_validate_mass_balance(model: Model) -> None: """Test reaction mass balance validation.""" assert len(check_mass_balance(model)) == 0 # if we remove the SBO term which marks the reaction as # mass balanced, then the reaction should be detected as # no longer mass balanced EX_rxn = model.reactions.query(lambda r: r.boundary)[0] EX_rxn.annotation.pop("sbo") balance = check_mass_balance(model) assert len(balance) == 1 assert EX_rxn in balance m1 = Metabolite("m1", formula="()") r1 = Reaction("r1") r1.add_metabolites({m1: 1}) with pytest.raises(ValueError), pytest.warns(UserWarning): r1.check_mass_balance()