tests: add a test for functions with a string return annotation
- ID
4dff711- date
2026-11-06 20:32:43+00:00- author
Alex Chan <alexc@tailscale.com>- parent
33d832a- message
tests: add a test for functions with a string return annotation- changed files
1 file, 13 additions
Changed files
tests/test_manager.py (18240 → 18597)
diff --git a/tests/test_manager.py b/tests/test_manager.py
index c6e3bda..cd4b969 100644
--- a/tests/test_manager.py
+++ b/tests/test_manager.py
@@ -56,6 +56,19 @@ class FunkyCacheTestSuite(ABC):
assert initial("banana") == "B"
assert calls == {"apple": 1, "banana": 1}
+ def test_cache_with_string_annotation(self, cache: FunkyCache) -> None:
+ """
+ You can register a function which uses a string as its
+ return annotation.
+ """
+
+ @cache.register
+ def initial(s: str) -> "str":
+ return s[0].upper()
+
+ for _ in range(3):
+ assert initial("apple") == "A"
+
def test_per_function_caches_are_independent(self, cache: FunkyCache) -> None:
"""
Different functions have different caches.