Skip to content

Replace assert with direct call for table validation#651

Merged
timtreis merged 1 commit intomainfrom
fix/issue-616-assert-stripped-validation
May 8, 2026
Merged

Replace assert with direct call for table validation#651
timtreis merged 1 commit intomainfrom
fix/issue-616-assert-stripped-validation

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 8, 2026

Summary

  • Replace assert _ensure_table_and_layer_exist_in_sdata(...) with a direct call in _type_check_params (src/spatialdata_plot/pl/utils.py).
  • assert is stripped under python -O / PYTHONOPTIMIZE=1, silently bypassing user-input validation. The function already raises ValueError on failure; its return value is unused, only the side effect matters.

Fixes #616.

`assert _ensure_table_and_layer_exist_in_sdata(...)` is stripped under
`python -O` / `PYTHONOPTIMIZE=1`, silently bypassing user-input
validation. Call the function unconditionally so it raises `ValueError`
regardless of interpreter optimization level.

Fixes #616
@timtreis timtreis changed the title Replace assert with direct call for table validation (#616) Replace assert with direct call for table validation May 8, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.86%. Comparing base (27728a1) to head (043e599).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #651   +/-   ##
=======================================
  Coverage   76.86%   76.86%           
=======================================
  Files          11       11           
  Lines        3277     3277           
  Branches      774      774           
=======================================
  Hits         2519     2519           
  Misses        457      457           
  Partials      301      301           
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/utils.py 67.19% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit e107c0a into main May 8, 2026
7 of 8 checks passed
@timtreis timtreis deleted the fix/issue-616-assert-stripped-validation branch May 8, 2026 16:51
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.

Table validation wrapped in assert — silently skipped under python -O / PYTHONOPTIMIZE=1

2 participants