From 13893c0e9ab897e01e84c3c2bb1d88363b30f571 Mon Sep 17 00:00:00 2001 From: Ryan Spangler Date: Thu, 6 Jun 2024 03:44:10 -0700 Subject: [PATCH] prefer initial state from processes --- process_bigraph/composite.py | 2 +- process_bigraph/experiments/growth_division.py | 1 + process_bigraph/tests.py | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/process_bigraph/composite.py b/process_bigraph/composite.py index a5cbfa1..ad8439a 100644 --- a/process_bigraph/composite.py +++ b/process_bigraph/composite.py @@ -665,7 +665,7 @@ def __init__(self, config=None, core=None): raise Exception( f'initial state from edge does not match initial state from other edges:\n{path}\n{edge}\n{edge_state}') - state = deep_merge(edge_state, state) + state = deep_merge(state, edge_state) self.state = self.core.deserialize( self.composition, diff --git a/process_bigraph/experiments/growth_division.py b/process_bigraph/experiments/growth_division.py index 5a3832d..3dd8618 100644 --- a/process_bigraph/experiments/growth_division.py +++ b/process_bigraph/experiments/growth_division.py @@ -189,6 +189,7 @@ def test_grow_divide(core): core=core) updates = composite.update({}, 100.0) + assert '0_0_0_0_0' in composite.state['environment'] @pytest.fixture diff --git a/process_bigraph/tests.py b/process_bigraph/tests.py index 4efdcf6..e883055 100644 --- a/process_bigraph/tests.py +++ b/process_bigraph/tests.py @@ -33,8 +33,7 @@ def outputs(self): def initial_state(self): return { - 'inputs': { - 'level': 11.0}} + 'level': 4.4} def update(self, state, interval): @@ -132,7 +131,7 @@ def test_infer(core): 'value': '11.11'}}, core=core) assert composite.composition['value']['_type'] == 'float' - assert composite.state['value'] == 11.11 + assert composite.state['value'] == 4.4 def test_process_type(core):