MCPcopy
hub / github.com/marimo-team/marimo / test_cache_ui_element_restore

Method test_cache_ui_element_restore

tests/_save/test_cache.py:197–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195
196 @staticmethod
197 def test_cache_ui_element_restore() -> None:
198 # Create a UIElement and convert it to a stub
199 original_dropdown = dropdown(options=[1, 2, 3])
200 stub = UIElementStub(original_dropdown)
201
202 cache = Cache(
203 defs={},
204 hash="123",
205 cache_type="Pure",
206 stateful_refs=set(),
207 hit=True,
208 meta={"return": stub},
209 )
210 scope = {}
211 cache.restore(scope)
212
213 # After restoration, should have a new UIElement instance with same properties
214 restored = cache.meta["return"]
215 assert isinstance(restored, type(original_dropdown))
216 assert restored is not original_dropdown # Different instance
217 assert restored.options == original_dropdown.options
218 assert restored.value == original_dropdown.value
219
220 @staticmethod
221 def test_cache_nested_ui_element_restore() -> None:

Callers

nothing calls this directly

Calls 4

restoreMethod · 0.95
dropdownClass · 0.90
UIElementStubClass · 0.90
CacheClass · 0.90

Tested by

no test coverage detected