Skip to content

Commit

Permalink
Fix tests which assumed global state
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Nov 22, 2024
1 parent 0148d97 commit 0f7cda2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_readonly_process_creation_deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ def test_change_functional_state_multiple_times(products):
assert bd.get_node(code="1")["type"] in ("process", "processwithreferenceproduct")
assert len(products) == 3

exc = list(bd.get_node(code="1").production())[0]
exc["functional"] = True
exc.save()
bd.get_node(code="1").allocate()
assert bd.get_node(code="1")["type"] == "multifunctional"
assert len(products) == 5

exc = list(bd.get_node(code="1").production())[0]
exc["functional"] = False
exc.save()
bd.get_node(code="1").allocate()
assert bd.get_node(code="1")["type"] in ("process", "processwithreferenceproduct")
assert len(products) == 3

exc = list(bd.get_node(code="1").production())[0]
exc["functional"] = True
exc.save()
bd.get_node(code="1").allocate()
Expand All @@ -105,18 +108,21 @@ def test_change_multifunctional_reduce_num_still_multifunctional(many_products):
assert bd.get_node(code="1")["type"] == 'multifunctional'
assert len(many_products) == 7

exc = [exc for exc in bd.get_node(code="1").exchanges() if exc.input['code'] == 'p1'][0]
exc["functional"] = True
exc.save()
bd.get_node(code="1").allocate()
assert bd.get_node(code="1")["type"] == "multifunctional"
assert len(many_products) == 8

exc = [exc for exc in bd.get_node(code="1").exchanges() if exc.input['code'] == 'p1'][0]
exc["functional"] = False
exc.save()
bd.get_node(code="1").allocate()
assert bd.get_node(code="1")["type"] == "multifunctional"
assert len(many_products) == 7

exc = [exc for exc in bd.get_node(code="1").exchanges() if exc.input['code'] == 'p1'][0]
exc["functional"] = True
exc.save()
bd.get_node(code="1").allocate()
Expand Down

0 comments on commit 0f7cda2

Please sign in to comment.