def test_build_is_association(self): """Test build_relation_predicate.""" alternate_is_associative_relation = build_relation_predicate(ASSOCIATION) g = BELGraph() g.add_edge(p1, p2, key=0, **{RELATION: ASSOCIATION}) g.add_edge(p2, p3, key=0, **{RELATION: INCREASES}) self.assertTrue(alternate_is_associative_relation(g, p1, p2, 0)) self.assertFalse(alternate_is_associative_relation(g, p2, p3, 0))
def test_build_is_increases_or_decreases(self): """Test build_relation_predicate with multiple relations.""" is_increase_or_decrease = build_relation_predicate([INCREASES, DECREASES]) g = BELGraph() g.add_edge(p1, p2, key=0, **{RELATION: ASSOCIATION}) g.add_edge(p2, p3, key=0, **{RELATION: INCREASES}) g.add_edge(p3, p4, key=0, **{RELATION: DECREASES}) self.assertFalse(is_increase_or_decrease(g, p1, p2, 0)) self.assertTrue(is_increase_or_decrease(g, p2, p3, 0)) self.assertTrue(is_increase_or_decrease(g, p3, p4, 0))