def test_genegroup_enabled_different_genes(self): group1 = GeneGroup() gene1 = Gene() gene1.functional = False group1.add_child(gene1) group1.type = "and" assert group1.functional is False group1.type = "or" assert group1.functional is False # Add second functional gene gene2 = Gene() gene2.functional = True group1.add_child(gene2) group1.type = "and" assert group1.functional is False group1.type = "or" assert group1.functional is True group1.type = "unknown" with pytest.raises(ValueError): group1.functional
def test_setting_resetting_boundaries(self): gene = Gene() reaction = Reaction(lower_bound=-1000., upper_bound=1000.) reaction.add_child(gene) gene.functional = True condition = GeneSetting(gene, False) assert gene.functional is True assert reaction.upper_bound == 1000. assert reaction.lower_bound == -1000. condition.do() assert gene.functional is False assert reaction.upper_bound == 0. assert reaction.lower_bound == 0. condition.undo() assert gene.functional is True assert reaction.upper_bound == 1000. assert reaction.lower_bound == -1000. # Check that calling undo second time does not change value condition.undo() assert gene.functional is True assert reaction.upper_bound == 1000. assert reaction.lower_bound == -1000.
def test_reaction_is_disabled_with_disabled_gene_only(self): reaction = Reaction() gene = Gene() gene.functional = False reaction.add_child(gene) assert reaction.functional is False
def test_reaction_is_disabled_with_gene_in_and_group(self): reaction = Reaction() genegroup = GeneGroup(type="and") reaction.add_child(genegroup) gene = Gene() genegroup.add_child(gene) gene.functional = False assert reaction.functional is False