Skip to content

Commit 11f21cd

Browse files
docs: clarify routing function docstring and strengthen TTL test assertions
- Remove misleading reference to 'key patterns' in routing wrapper docstring since the routing function only receives the collection name, not keys - Add explicit TTL validation in ttl_many test to ensure returned values are not None and are positive - Split compound assertions to comply with PT018 lint rule Co-authored-by: William Easton <[email protected]>
1 parent f1281f6 commit 11f21cd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

key-value/key-value-aio/src/key_value/aio/wrappers/routing/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class RoutingWrapper(BaseWrapper):
1414
1515
The routing function receives the collection name and returns the appropriate store.
1616
This allows dynamic routing of requests to different backing stores based on
17-
collection name, key patterns, or any other custom logic.
17+
collection name or other custom logic.
1818
1919
Example:
2020
def route_by_collection(collection: str | None) -> AsyncKeyValue | None:

key-value/key-value-aio/tests/stores/wrappers/test_routing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def route(collection: str | None) -> AsyncKeyValue | None:
151151
assert len(results) == 2
152152
assert results[0][0] == {"data": "v2"}
153153
assert results[1][0] == {"data": "v3"}
154+
assert results[0][1] is not None
155+
assert results[0][1] > 0
156+
assert results[1][1] is not None
157+
assert results[1][1] > 0
154158

155159

156160
class TestCollectionRoutingWrapper:

0 commit comments

Comments
 (0)