From 0f7cda21716d9950b3a9501c950f3586cdc1f4ec Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Fri, 22 Nov 2024 23:30:52 +0100 Subject: [PATCH] Fix tests which assumed global state --- tests/test_readonly_process_creation_deletion.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_readonly_process_creation_deletion.py b/tests/test_readonly_process_creation_deletion.py index 974c5b2..e39fbe1 100644 --- a/tests/test_readonly_process_creation_deletion.py +++ b/tests/test_readonly_process_creation_deletion.py @@ -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() @@ -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()