Skip to content

Commit 2515a54

Browse files
committed
FIX: Black formatting
Signed-off-by: KyleErwin <[email protected]>
1 parent a86c478 commit 2515a54

File tree

3 files changed

+19
-215
lines changed

3 files changed

+19
-215
lines changed

tests/reasoning/gm/gm_perf_test.py

Lines changed: 0 additions & 171 deletions
This file was deleted.

tests/reasoning/gm/test_gm_binding_1.py

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def test():
5757
)
5858

5959
p2_and_p2a.upward()
60-
assert all([p2_and_p2a.state(groundings=g)
61-
is GT[g] for g in GT]), "FAILED 😔"
60+
assert all([p2_and_p2a.state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
6261
assert len(p2_and_p2a.state()) == len(GT), "FAILED 😔"
6362

6463
model = Model()
@@ -92,14 +91,10 @@ def test():
9291

9392
model.add_knowledge(p2_and_p2b)
9493

95-
GT = dict([
96-
(('s1', 's7'), TRUE),
97-
(('s3', 's7'), FALSE),
98-
(('s4', 's7'), FALSE)])
94+
GT = dict([(("s1", "s7"), TRUE), (("s3", "s7"), FALSE), (("s4", "s7"), FALSE)])
9995

10096
model[p2_and_p2b].upward()
101-
assert all([model[p2_and_p2b].state(groundings=g) is GT[g]
102-
for g in GT]), "FAILED 😔"
97+
assert all([model[p2_and_p2b].state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
10398
assert len(model[p2_and_p2b].state()) == len(GT), "FAILED 😔"
10499
# New test case
105100
model = Model()
@@ -130,12 +125,9 @@ def test():
130125
p2_and_p2c = And(p2(x, y), p2a(x, y, bind={x: ["s1", "s2"], y: "s6"}))
131126
model.add_knowledge(p2_and_p2c)
132127

133-
GT = dict([
134-
(('s1', 's6'), FALSE),
135-
(('s2', 's6'), FALSE)])
128+
GT = dict([(("s1", "s6"), FALSE), (("s2", "s6"), FALSE)])
136129
model[p2_and_p2c].upward()
137-
assert all([model[p2_and_p2c].state(groundings=g) is GT[g]
138-
for g in GT]), "FAILED 😔"
130+
assert all([model[p2_and_p2c].state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
139131
assert len(model[p2_and_p2c].state()) == len(GT), "FAILED 😔"
140132
# 1 variable vs 2 variables bound
141133
model = Model()
@@ -157,13 +149,9 @@ def test():
157149
p1_and_p2 = And(p1(x, bind={x: ["s1", "s2"]}), p2(x, y))
158150

159151
model.add_knowledge(p1_and_p2)
160-
GT = dict([
161-
(('s1', 's6'), TRUE),
162-
(('s2', 's6'), FALSE),
163-
(('s1', 's7'), TRUE)])
152+
GT = dict([(("s1", "s6"), TRUE), (("s2", "s6"), FALSE), (("s1", "s7"), TRUE)])
164153
model[p1_and_p2].upward()
165-
assert all([model[p1_and_p2].state(groundings=g) is GT[g]
166-
for g in GT]), "FAILED 😔"
154+
assert all([model[p1_and_p2].state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
167155
assert len(model[p1_and_p2].state()) == len(GT), "FAILED 😔"
168156
# New test case
169157
model = Model()
@@ -194,10 +182,8 @@ def test():
194182
p2_and_p3 = And(p2(x, y), p3(x, z, y, bind={z: "s4"}))
195183
model.add_knowledge(p2_and_p3)
196184
model[p2_and_p3].upward()
197-
GT = dict([
198-
(('s1', 's7', 's4'), TRUE)])
199-
assert all([model[p2_and_p3].state(groundings=g) is GT[g]
200-
for g in GT]), "FAILED 😔"
185+
GT = dict([(("s1", "s7", "s4"), TRUE)])
186+
assert all([model[p2_and_p3].state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
201187
assert len(model[p2_and_p3].state()) == len(GT), "FAILED 😔"
202188
# New test case
203189
model = Model()
@@ -221,10 +207,8 @@ def test():
221207
model.add_knowledge(p2_and_p2r)
222208

223209
p2_and_p2r.upward()
224-
GT = dict([
225-
(('s1', 's7'), FALSE)])
226-
assert all([model[p2_and_p2r].state(groundings=g) is GT[g]
227-
for g in GT]), "FAILED 😔"
210+
GT = dict([(("s1", "s7"), FALSE)])
211+
assert all([model[p2_and_p2r].state(groundings=g) is GT[g] for g in GT]), "FAILED 😔"
228212
assert len(model[p2_and_p2r].state()) == len(GT), "FAILED 😔"
229213
return
230214

tests/reasoning/logic/fol/test_american.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from lnn import (Predicate, Variable, Join, And, Exists,
2-
Implies, ForAll, Model, Fact)
1+
from lnn import Predicate, Variable, Join, And, Exists, Implies, ForAll, Model, Fact
32

43

54
def test_1():
@@ -26,8 +25,7 @@ def test_1():
2625
ForAll(
2726
x,
2827
y,
29-
Implies(enemy(x, y, bind={y: "America"}), hostile(x),
30-
join=Join.OUTER),
28+
Implies(enemy(x, y, bind={y: "America"}), hostile(x), join=Join.OUTER),
3129
join=Join.OUTER,
3230
),
3331
ForAll(
@@ -36,8 +34,7 @@ def test_1():
3634
z,
3735
Implies(
3836
And(
39-
american(x), weapon(y), sells(x, y, z), hostile(z),
40-
join=Join.OUTER
37+
american(x), weapon(y), sells(x, y, z), hostile(z), join=Join.OUTER
4138
),
4239
criminal(x),
4340
join=Join.OUTER,
@@ -49,15 +46,13 @@ def test_1():
4946
y,
5047
z,
5148
Implies(
52-
And(missile(x), owns(y, x, bind={y: "Nono"}),
53-
join=Join.OUTER),
49+
And(missile(x), owns(y, x, bind={y: "Nono"}), join=Join.OUTER),
5450
sells(z, x, y, bind={z: "West", y: "Nono"}),
5551
join=Join.OUTER,
5652
),
5753
join=Join.OUTER,
5854
),
59-
ForAll(x, Implies(missile(x), weapon(x), join=Join.OUTER),
60-
join=Join.OUTER),
55+
ForAll(x, Implies(missile(x), weapon(x), join=Join.OUTER), join=Join.OUTER),
6156
)
6257

6358
model.set_query(query)
@@ -76,8 +71,7 @@ def test_1():
7671
model.print()
7772
GT_o = dict([("West", Fact.TRUE)])
7873
model.print()
79-
assert all([model.query.state(groundings=g) is GT_o[g] for g in GT_o]), \
80-
"FAILED 😔"
74+
assert all([model.query.state(groundings=g) is GT_o[g] for g in GT_o]), "FAILED 😔"
8175

8276

8377
def test_2():
@@ -111,9 +105,7 @@ def test_2():
111105
y,
112106
z,
113107
Implies(
114-
And(
115-
american(x), weapon(y), sells(x, y, z), hostile(z)
116-
),
108+
And(american(x), weapon(y), sells(x, y, z), hostile(z)),
117109
criminal(x),
118110
),
119111
),
@@ -145,8 +137,7 @@ def test_2():
145137
model.print()
146138
GT_o = dict([("West", Fact.TRUE)])
147139
model.print()
148-
assert all([model.query.state(groundings=g) is GT_o[g] for g in GT_o]), \
149-
"FAILED 😔"
140+
assert all([model.query.state(groundings=g) is GT_o[g] for g in GT_o]), "FAILED 😔"
150141

151142

152143
if __name__ == "__main__":

0 commit comments

Comments
 (0)