Skip to content

Add test coverage for parse_edid#3

Closed
Copilot wants to merge 2 commits intofeat-xcb-better-monitorsfrom
copilot/sub-pr-2
Closed

Add test coverage for parse_edid#3
Copilot wants to merge 2 commits intofeat-xcb-better-monitorsfrom
copilot/sub-pr-2

Conversation

Copy link

Copilot AI commented Feb 20, 2026

parse_edid in tools.py had no test coverage. This PR adds a _make_edid helper and 12 tests covering all major code paths.

Tests added

  • Error paths: too-short blocks, invalid checksum, invalid header
  • Basic parsing: id_legacy field construction from packed manufacturer ID + product code
  • Manufacture date: year-only, week+year, model year (manufacture_week=0xFF)
  • Serial number: integer form, not set, string descriptor form, string overriding integer
  • Descriptors: serial number string (0xFF), display name (0xFC)

Helper

_make_edid() constructs a valid 128-byte EDID block with correct checksum, supporting all fields needed by the tests:

_make_edid(
    manufacturer="TST",
    product_code=0x1234,
    serial_number=99,
    manufacture_week=10,
    manufacture_year=30,           # 1990 + 30 = 2020
    descriptors=[(0x48, 0xFF, "STRSERIAL")],
)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jholveck <240807535+jholveck@users.noreply.github.com>
Copilot AI changed the title [WIP] Update detail about monitors on Linux Add test coverage for parse_edid Feb 20, 2026
Copilot AI requested a review from jholveck February 20, 2026 08:23
@jholveck jholveck closed this Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants