Skip to content

Replace runtime validation asserts#108

Open
pragnyanramtha wants to merge 2 commits into
mllam:mainfrom
pragnyanramtha:fix-runtime-validation-asserts-101
Open

Replace runtime validation asserts#108
pragnyanramtha wants to merge 2 commits into
mllam:mainfrom
pragnyanramtha:fix-runtime-validation-asserts-101

Conversation

@pragnyanramtha

Copy link
Copy Markdown

Summary

  • Replace user-facing validation asserts with explicit ValueError checks
  • Cover selection, convex hull coordinate validation, and config path validation
  • Add optimized-mode regression coverage for the config entrypoint

Fixes #101

Tests

  • pytest tests/test_selection.py::test_error_on_empty_range tests/test_selection.py::test_error_on_equal_range_bounds tests/test_convex_hull_cropping.py::test_create_convex_hull_mask_requires_matching_lat_lon_dims tests/test_config.py::test_config_main_rejects_non_yaml_path -q
  • python -O -m pytest tests/test_selection.py::test_error_on_empty_range tests/test_selection.py::test_error_on_equal_range_bounds tests/test_convex_hull_cropping.py::test_create_convex_hull_mask_requires_matching_lat_lon_dims tests/test_config.py::test_config_main_rejects_non_yaml_path -q
  • python -m black --check mllam_data_prep/config.py mllam_data_prep/ops/cropping.py mllam_data_prep/ops/selection.py tests/test_config.py tests/test_convex_hull_cropping.py tests/test_selection.py
  • python -m isort --check-only mllam_data_prep/config.py mllam_data_prep/ops/cropping.py mllam_data_prep/ops/selection.py tests/test_config.py tests/test_convex_hull_cropping.py tests/test_selection.py
  • python -m flake8 mllam_data_prep/config.py mllam_data_prep/ops/cropping.py mllam_data_prep/ops/selection.py tests/test_config.py tests/test_convex_hull_cropping.py tests/test_selection.py
  • git diff --check

Copilot AI review requested due to automatic review settings May 13, 2026 23:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces runtime input-validation assert statements (which are skipped under python -O) with explicit ValueError checks, and adds regression tests to ensure the validations still trigger in optimized mode.

Changes:

  • Replace assert-based validation in selection range handling and convex-hull lat/lon dimension checks with ValueError exceptions.
  • Replace config entrypoint .yaml extension validation assert with an explicit ValueError.
  • Add/adjust tests to expect ValueError and to exercise the config entrypoint under python -O.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_selection.py Updates selection tests to expect ValueError (and adds equal-bounds coverage).
tests/test_convex_hull_cropping.py Adds a test ensuring mismatched lat/lon dims raise ValueError.
tests/test_config.py Adds an optimized-mode (-O) subprocess test for rejecting non-.yaml config paths.
mllam_data_prep/ops/selection.py Replaces selection asserts with explicit ValueError checks.
mllam_data_prep/ops/cropping.py Replaces convex-hull coordinate dimension asserts with ValueError checks (plus minor formatting).
mllam_data_prep/config.py Replaces .yaml extension assert with ValueError in the module entrypoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mllam_data_prep/ops/cropping.py
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.

Replace assert statements with proper exceptions for runtime validation

2 participants