Skip to content

Commit f031997

Browse files
fix: rename tautological test to honest roundtrip
test_header_decode_wraps_struct_error claimed to test struct.error wrapping but actually performed a successful roundtrip on valid data. The struct.error path in Header.decode is unreachable because the length check fires first. Rename to test_header_roundtrip_minimal to honestly describe what the test exercises. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e2ccf4e commit f031997

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

tests/test_codec.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,10 @@ def test_header_decode_empty_raises_decode_error(self) -> None:
158158
with pytest.raises(DecodeError):
159159
Header.decode(b"")
160160

161-
def test_header_decode_wraps_struct_error(self) -> None:
162-
"""Header.decode should wrap struct.error in DecodeError for consistency.
163-
164-
Header.encode wraps struct.error in EncodeError. Header.decode should
165-
do the same with DecodeError, even though the length check makes
166-
struct.error unlikely in practice.
167-
"""
161+
def test_header_roundtrip_minimal(self) -> None:
162+
"""Minimal header with msg_type=0 and schema=0 roundtrips."""
168163
from dqlitewire.messages.base import Header
169164

170-
# Valid length but still exercises the try/except path
171165
header = Header(size_words=1, msg_type=0, schema=0)
172166
data = header.encode()
173167
decoded = Header.decode(data)

0 commit comments

Comments
 (0)