Skip to content

Commit fc33085

Browse files
committed
Add mutation event after fork to the old scope
1 parent 7edca64 commit fc33085

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_scope.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ def test_scope_flags_copy():
4949
old_scope.flags.set("a", True)
5050

5151
# Scope is forked; flag buffer is copied and contains the data of
52-
# the parent. The flag is overwritten.
52+
# the parent. The flag is overwritten on the child. The parent
53+
# scope can continue mutating without interfering with the child.
5354
new_scope = old_scope.fork()
5455
new_scope.flags.set("a", False)
56+
old_scope.flags.set("b", True)
5557

5658
# New scope has the change. Old scope was not polluted by changes
5759
# to the new scope.
58-
old_scope.flags.get() == [{"flag": "a", "result": True}]
60+
old_scope.flags.get() == [
61+
{"flag": "a", "result": True},
62+
{"flag": "b", "result": True},
63+
]
5964
new_scope.flags.get() == [{"flag": "a", "result": False}]
6065

6166

0 commit comments

Comments
 (0)