Merge 51961b975d
into 98f50811f9
This commit is contained in:
commit
7d0f4c91e7
@ -2093,6 +2093,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
||||
# Never serialize parent_state or substates.
|
||||
state["__dict__"].pop("parent_state", None)
|
||||
state["__dict__"].pop("substates", None)
|
||||
state["__dict__"].pop("dirty_vars", None)
|
||||
state["__dict__"].pop("dirty_substates", None)
|
||||
state["__dict__"].pop("_was_touched", None)
|
||||
# Remove all inherited vars.
|
||||
for inherited_var_name in self.inherited_vars:
|
||||
@ -2109,6 +2111,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
||||
"""
|
||||
state["__dict__"]["parent_state"] = None
|
||||
state["__dict__"]["substates"] = {}
|
||||
state["__dict__"]["dirty_vars"] = set()
|
||||
state["__dict__"]["dirty_substates"] = set()
|
||||
super().__setstate__(state)
|
||||
|
||||
def _check_state_size(
|
||||
|
@ -2581,10 +2581,7 @@ def test_mutable_copy(mutable_state: MutableTestState, copy_func: Callable):
|
||||
assert getattr(ms_copy, attr) is not getattr(mutable_state, attr)
|
||||
ms_copy.custom.array.append(42)
|
||||
assert "custom" in ms_copy.dirty_vars
|
||||
if copy_func is copy.copy:
|
||||
assert "custom" in mutable_state.dirty_vars
|
||||
else:
|
||||
assert not mutable_state.dirty_vars
|
||||
assert not mutable_state.dirty_vars
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
Loading…
Reference in New Issue
Block a user