MCPcopy Index your code
hub / github.com/reactive-python/reactpy / test_option_subscribe

Function test_option_subscribe

src/py/reactpy/tests/test__option.py:85–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84
85def test_option_subscribe():
86 opt = Option("A_FAKE_OPTION", "default")
87
88 calls = []
89 opt.subscribe(calls.append)
90 assert calls == ["default"]
91
92 opt.current = "default"
93 # value did not change, so no trigger
94 assert calls == ["default"]
95
96 opt.current = "new-1"
97 opt.current = "new-2"
98 assert calls == ["default", "new-1", "new-2"]
99
100 opt.unset()
101 assert calls == ["default", "new-1", "new-2", "default"]
102
103
104def test_deprecated_option():

Callers

nothing calls this directly

Calls 3

subscribeMethod · 0.95
unsetMethod · 0.95
OptionClass · 0.90

Tested by

no test coverage detected