We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e402614 commit 418f052Copy full SHA for 418f052
1 file changed
tests/test_call_with_freshness_threshold.py
@@ -0,0 +1,23 @@
1
+import time
2
+from datetime import timedelta
3
+
4
+import cachier
5
6
+def test_call_with_freshness_threshold():
7
+ @cachier.cachier()
8
+ def test_func(a, b):
9
+ print('Computing...')
10
+ return a + b
11
12
+ print(f'{test_func(1, 2) = }')
13
14
+ caller_with_freshness_threshold = test_func.caller_with_freshness_threshold(
15
+ timedelta(seconds=0.5),
16
+ )
17
+ print(f'{caller_with_freshness_threshold(1, 2) = }')
18
+ print(f'{time.sleep(1.0) = }')
19
20
21
22
+if __name__ == '__main__':
23
+ test_call_with_freshness_threshold()
0 commit comments