Skip to content

geotiff: cover compress()/decompress() dispatcher error branches (#2995)#2996

Merged
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-geotiff-2026-06-06-01-dispatcher-errors
Jun 6, 2026
Merged

geotiff: cover compress()/decompress() dispatcher error branches (#2995)#2996
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-geotiff-2026-06-06-01-dispatcher-errors

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #2995.

Test-coverage sweep finding (Cat 4, error-path coverage). The codec dispatchers in xrspatial/geotiff/_compression.py had five guard raises that no test exercised:

  • compress(data, COMPRESSION_JPEG | COMPRESSION_JPEG2000 | COMPRESSION_LERC) -- the byte-stream entry point cannot encode block codecs (they need width/height/samples), so it raises a redirect to the dedicated *_compress() helpers.
  • compress() and decompress() reject unknown tags via their else branch.

Adds TestDispatcherErrorBranches to unit/test_codec_roundtrip.py (5 tests). The constants and the compress/decompress dispatchers were already imported in that module, so no new imports were needed.

Source is unchanged. All 5 new tests pass locally (full file: 117 passed).

Add TestDispatcherErrorBranches to unit/test_codec_roundtrip.py pinning
the five untested guard raises in the codec dispatchers:

- compress() rejects JPEG / JPEG2000 / LERC with a redirect to the
  block-codec entry points (these need width/height/samples).
- compress() and decompress() reject unknown compression tags via the
  else branch.

Test-only; source unchanged. 5 tests, all passing locally.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Jun 6, 2026
@brendancol brendancol merged commit e8a12b1 into main Jun 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

geotiff: cover compress()/decompress() dispatcher error branches

1 participant