Minor clean up / bikeshedding - #406
Open
alessio-locatelli wants to merge 9 commits into
Open
Conversation
The function sets up a mock aiohttp test application, performs a GET request through a test client, and wraps the result in a `CachedResponse`. The name reflects the primary action (fetching over HTTP) and the return type, while leaving the mock infrastructure as an implementation detail. Alternatives considered: - `get_cached_response` — easily confused with HTTP GET - `make_cached_response` — downplays the network round-trip - `mock_request_cached_response` — accurate but overly verbose
The function is a test factory that returns a `MagicMock` with `spec=CachedResponse` and sensible defaults (`status=200`, `is_expired=False`, etc.). The name follows Python testing conventions (`make_*` for lightweight test factories) and clearly describes both the action and the return type. Alternatives considered: - `mock_cached_response` — reads like a fixture, not a callable - `create_mock_cached_response` — implies heavier construction than exists here - `build_cached_response_mock` — overly verbose and awkward word order
The function extracts parameter definitions from multiple input Callables, deduplicates overlapping kwargs, and returns a unified forged signature. The name reflects the core operation (merging multiple signatures) and the return type. Alternatives considered: - `combine_signatures` — equally valid, but `merge` is more idiomatic for unifying collections - `compose_signatures` — implies functional composition, which doesn't apply here - `collect_signature_params` — too narrow; returns a full signature, not just a dict
The inner async function connects to a Redis instance, calls `info()` to confirm the server is reachable, then closes the connection. The name uses `probe` to convey a lightweight connectivity check. Alternatives considered: - `_ping_redis` — common idiom but technically inaccurate; calls `info()`, not `PING` - `_check_redis_connection` — descriptive but overly long for a nested closure - `_redis_info` — sounds like a getter, not a connectivity probe - `_connect_and_verify` — generic; doesn't name the target service
The code adds a name that does not improve the reader's understanding. That is usually a poor tradeoff: it adds a statement, a local variable, and a name that the reader must mentally associate with statement. Do not introduce a local variable solely to satisfy a line-length limit.
The argument is already `str`.
Collaborator
Author
|
FYI: The first CI attempt failed with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The changes are behavior-preserving refactors or cleanup, so no changelog entry is needed.