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

Method test_cache_function_hit

tests/_save/test_cache.py:632–658  ·  view source on GitHub ↗
(self, any_kernel: Kernel)

Source from the content-addressed store, hash-verified

630 assert k.globals["mo"].__version__ == marimo.__version__
631
632 async def test_cache_function_hit(self, any_kernel: Kernel) -> None:
633 k = any_kernel
634 await k.run(
635 [
636 ExecuteCellCommand(
637 cell_id="0",
638 code=textwrap.dedent(
639 """
640 from marimo._save.save import persistent_cache
641 from tests._save.loaders.mocks import MockLoader
642
643 def my_func_2():
644 return 2
645
646 loader = MockLoader(data={"my_func": my_func_2}, strict=True)
647 with persistent_cache(name="one", _loader=loader) as cache:
648 def my_func():
649 return 1
650 """
651 ),
652 ),
653 ]
654 )
655 assert "cache" in k.globals
656 assert not k.stdout.messages, k.stdout
657 assert not k.stderr.messages, (k.stderr, k.stdout)
658 assert k.globals["my_func"]() == 2
659
660 async def test_cache_function_miss(self, any_kernel: Kernel) -> None:
661 k = any_kernel

Callers

nothing calls this directly

Calls 2

ExecuteCellCommandClass · 0.90
runMethod · 0.45

Tested by

no test coverage detected