MCPcopy Index your code
hub / github.com/marimo-team/marimo / test_cache_iterable

Method test_cache_iterable

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

Source from the content-addressed store, hash-verified

84 @staticmethod
85 @patch("marimo._save._cache_module.ModuleStub", TestableModuleStub)
86 def test_cache_iterable() -> None:
87 scope = {
88 "_tuple": (1, 2, 3, marimo),
89 "_set": {1, 2, 3, marimo},
90 }
91 cache = Cache(
92 defs=scope,
93 hash="123",
94 cache_type="Pure",
95 stateful_refs=set(),
96 hit=True,
97 meta={},
98 )
99
100 # Force update to trigger stubbing.
101 cache.update(scope, {"return": None})
102 assert "_tuple" in cache.defs
103 assert "_set" in cache.defs
104 assert isinstance(cache.defs["_tuple"][-1], ModuleStub)
105 assert TestableModuleStub(marimo) in cache.defs["_set"]
106
107 cache.restore(scope)
108 assert marimo == cache.defs["_tuple"][-1]
109 assert marimo in cache.defs["_set"]
110
111 @staticmethod
112 def test_cache_preserves_ref() -> None:

Callers

nothing calls this directly

Calls 4

updateMethod · 0.95
restoreMethod · 0.95
CacheClass · 0.90
TestableModuleStubClass · 0.90

Tested by

no test coverage detected