(self, any_kernel: Kernel)
| 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 |
nothing calls this directly
no test coverage detected