| 59 | |
| 60 | @staticmethod |
| 61 | def test_cache_scope_recursive() -> None: |
| 62 | _list = [] |
| 63 | _list.append(_list) |
| 64 | d = {} |
| 65 | d["self"] = d |
| 66 | scope = { |
| 67 | "_list": _list, |
| 68 | "_dict": d, |
| 69 | } |
| 70 | cache = Cache( |
| 71 | defs=scope, |
| 72 | hash="123", |
| 73 | cache_type="Pure", |
| 74 | stateful_refs=set(), |
| 75 | hit=True, |
| 76 | meta={}, |
| 77 | ) |
| 78 | |
| 79 | # Force update to trigger stubbing. |
| 80 | cache.update(scope, {"return": None}) |
| 81 | assert "_list" in cache.defs |
| 82 | assert "_dict" in cache.defs |
| 83 | |
| 84 | @staticmethod |
| 85 | @patch("marimo._save._cache_module.ModuleStub", TestableModuleStub) |