- Cover the new utilities helpers (unpad, crc32, checksumPid type preservation, pidFromSerial, safe_join) and drop the now-redundant per-module crc32 tests. - Rename test_unpad_removes_pkcs7_padding to reflect that unpad only trusts the trailing pad-length byte rather than validating PKCS#7. - Replace the KOBO_HASH_KEYS change-detector with a test that documents the intentional value pin and checks the ASCII-salt contract. - Note kgenpids' hybrid import in the test-loader docstring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
509 B
Python
19 lines
509 B
Python
"""Tests for ineptpdf parsing helpers."""
|
|
|
|
import dedrm_test_utils as U
|
|
|
|
pdf = U.load("ineptpdf", package="dedrm")
|
|
|
|
|
|
def test_nunpack_lengths():
|
|
assert pdf.nunpack(b"") == 0
|
|
assert pdf.nunpack(b"", default=7) == 7
|
|
assert pdf.nunpack(b"\x05") == 5
|
|
assert pdf.nunpack(b"\x01\x00") == 256
|
|
assert pdf.nunpack(b"\x01\x00\x00") == 65536
|
|
assert pdf.nunpack(b"\x01\x00\x00\x00") == 16777216
|
|
|
|
|
|
def test_unpad_strips_trailing_pad_length():
|
|
assert pdf.unpad(b"hello\x03\x03\x03") == b"hello"
|