Skip to content

Raise clear error for all-empty shapes#674

Merged
timtreis merged 1 commit into
mainfrom
fix/issue-629
May 20, 2026
Merged

Raise clear error for all-empty shapes#674
timtreis merged 1 commit into
mainfrom
fix/issue-629

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 20, 2026

Summary

  • Detect shape elements that contain only empty geometries before calling get_extent in PlotAccessor.show.
  • Replace the bare upstream AssertionError("Cannot compute extent of an empty collection of geometries.") with a ValueError that names the offending element(s) and coordinate system.

Closes #629.

Previously `render_shapes(...).show()` crashed with a bare upstream
`AssertionError("Cannot compute extent of an empty collection of
geometries.")` when every geometry in a shape element was empty. Detect
this up front before calling `get_extent` and raise a `ValueError`
naming the element(s) and coordinate system instead.
@timtreis timtreis changed the title Raise clear error for all-empty shapes (#629) Raise clear error for all-empty shapes May 20, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.63%. Comparing base (59da170) to head (6715157).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/spatialdata_plot/pl/basic.py 50.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #674   +/-   ##
=======================================
  Coverage   77.63%   77.63%           
=======================================
  Files          11       11           
  Lines        3612     3630   +18     
  Branches      850      858    +8     
=======================================
+ Hits         2804     2818   +14     
- Misses        485      486    +1     
- Partials      323      326    +3     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/basic.py 86.12% <50.00%> (-0.48%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 7cb3133 into main May 20, 2026
7 of 8 checks passed
@timtreis timtreis deleted the fix/issue-629 branch May 20, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render_shapes crashes with AssertionError when all geometries are empty

2 participants