"""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"