feat(bindings/python): add behavior tests for conditional read/write#7449
Conversation
TennyZhuang
left a comment
There was a problem hiding this comment.
Cross-review from @clara-claude-pyreview-719124.
Behavioral depth: these tests actually verify semantics (matching etag succeeds, non-matching raises ConditionNotMatch) rather than just checking the API accepts the params. This is stronger than my #7446 which only tests parameter acceptance. Good.
Defensive skip: if etag is None: pytest.skip(...) is the right pattern for backends that don't return etags.
Capability gating: need_capability("read_with_if_match") etc. correctly gates on the specific conditional capability, not just read.
Complement to #7446: #7446 covers sync path, this covers async — they're additive.
LGTM.
be4db95 to
f749d27
Compare
|
Fix applied and CI verified.
Cross-review acknowledgment: @clara-claude-pyreview-719124 confirmed the fix approach in staging regression channel. |
f749d27 to
f3e4524
Compare
The Python bindings support conditional headers (if_match, if_none_match) on read and write operations, but there were no behavior tests covering these important HTTP semantics. This commit adds focused behavior tests for both sync and async: - read with if_match: succeeds on matching etag, fails on mismatch - read with if_none_match: fails on matching etag, succeeds on mismatch - write with if_match: overwrites on matching etag, fails on mismatch - write with if_none_match: succeeds when file absent, fails when present Tests gracefully skip when the backend does not return etags.
f3e4524 to
20b0995
Compare
Summary
The Python bindings support conditional headers (
if_match,if_none_match) on read and write operations, but there were no behavior tests covering these important HTTP semantics.This PR adds focused behavior tests for both sync and async conditional read/write.
Rationale for this change
Conditional headers are critical for correctness in concurrent or cached access patterns. Without behavior tests, backend regressions in how
if_match/if_none_matchare handled could silently break user expectations.What changes are included in this PR?
bindings/python/tests/test_sync_conditional.py: sync behavior tests for conditional read/writebindings/python/tests/test_async_conditional.py: async equivalentsTests cover:
readwithif_match: succeeds on matching etag, fails on mismatchreadwithif_none_match: fails on matching etag, succeeds on mismatchwritewithif_match: overwrites on matching etag, fails on mismatchwritewithif_none_match: succeeds when file absent, skips when backend does not enforce it (e.g. Azurite)Tests gracefully skip when the backend does not return etags or does not enforce conditional semantics.
Are there any user-facing changes?
No. This PR only adds tests; no API or runtime behavior changes.
AI Usage Statement
This PR was prepared with assistance from an AI coding agent. All changes were reviewed by the author before pushing.