/
test_configurations.py
36 lines (31 loc) · 1.06 KB
/
test_configurations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import unittest
import bonesis
class TestConfiguration(unittest.TestCase):
def test_node_equal1(self):
pkn = bonesis.InfluenceGraph.complete("abc", sign=1, loops=False,
allow_skipping_nodes=False)
data = {
"x": {"a": 0},
"y": {"a": 1},
}
bo = bonesis.BoNesis(pkn, data)
x = ~bo.obs("x")
y = ~bo.obs("y")
x >= y
x["c"] = y["c"]
for _, cfgs in bo.boolean_networks(limit=15, extra="configurations"):
self.assertEqual(cfgs["x"]["c"], cfgs["y"]["c"])
def test_node_diff1(self):
pkn = bonesis.InfluenceGraph.complete("abc", sign=1, loops=False,
allow_skipping_nodes=False)
data = {
"x": {"a": 0},
"y": {"a": 1},
}
bo = bonesis.BoNesis(pkn, data)
x = ~bo.obs("x")
y = ~bo.obs("y")
x >= y
x["c"] != y["c"]
for _, cfgs in bo.boolean_networks(limit=15, extra="configurations"):
self.assertNotEqual(cfgs["x"]["c"], cfgs["y"]["c"])