Skip to content

Commit

Permalink
Clear pollution and remove all manual clear().
Browse files Browse the repository at this point in the history
  • Loading branch information
LALAYANG committed Nov 16, 2021
1 parent 1f846de commit 62acbf9
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions tests/test_assoccomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ def results(g, s=None):
def test_eq_comm():
x, y, z = var(), var(), var()

commutative.facts.clear()
commutative.index.clear()

comm_op = "comm_op"

Expand Down Expand Up @@ -326,8 +324,6 @@ def test_eq_assoc():

assoc_op = "assoc_op"

associative.index.clear()
associative.facts.clear()

fact(associative, assoc_op)

Expand Down Expand Up @@ -449,8 +445,6 @@ def test_eq_assoccomm():

ac = "commassoc_op"

commutative.index.clear()
commutative.facts.clear()

fact(commutative, ac)
fact(associative, ac)
Expand Down Expand Up @@ -545,10 +539,6 @@ def test_assoccomm_algebra():
add = "add"
mul = "mul"

commutative.index.clear()
commutative.facts.clear()
associative.index.clear()
associative.facts.clear()

fact(commutative, add)
fact(associative, add)
Expand All @@ -565,10 +555,6 @@ def test_assoccomm_algebra():

def test_assoccomm_objects():

commutative.index.clear()
commutative.facts.clear()
associative.index.clear()
associative.facts.clear()

fact(commutative, Add)
fact(associative, Add)
Expand All @@ -578,3 +564,11 @@ def test_assoccomm_objects():
assert run(0, True, eq_assoccomm(add(1, 2, 3), add(3, 1, 2))) == (True,)
assert run(0, x, eq_assoccomm(add(1, 2, 3), add(1, 2, x))) == (3,)
assert run(0, x, eq_assoccomm(add(1, 2, 3), add(x, 2, 1))) == (3,)

@pytest.fixture(autouse=True)
def clear_assoccomm():
commutative.index.clear()
commutative.facts.clear()
associative.index.clear()
associative.facts.clear()
yield

0 comments on commit 62acbf9

Please sign in to comment.