Skip to content

Commit c5063d8

Browse files
author
Fabien Coelho
committed
improve test
1 parent acb4c1c commit c5063d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,13 @@ def test_nogil():
647647
def repeat(s: str, n: int) -> str:
648648
return s * n
649649

650-
assert foo("a", 3) == "aaa" and foo("a", 2) == "aa"
651-
assert foo("a", 3) == "aaa" and foo("a", 2) == "aa"
650+
@ctu.cached(ctu.AutoPrefixedCache(cache))
651+
def banged(s: str, n: int) -> str:
652+
return repeat(s, n) + "!"
653+
654+
assert banged("a", 3) == "aaa!" # +2 entries
655+
assert repeat("a", 3) == "aaa" # hit
656+
assert banged("a", 3) == "aaa!" # hit
652657
assert cache.hits() == 0.5
653658

654659
assert not sys._is_gil_enabled()

0 commit comments

Comments
 (0)