Skip to content

MNT: raise typed stochastic exceptions instead of bare AssertionError - #1221

Open
Gui-FernandesBR wants to merge 1 commit into
developfrom
mnt/stochastic-exceptions
Open

Gui-FernandesBR wants to merge 1 commit into
developfrom
mnt/stochastic-exceptions

Conversation

@Gui-FernandesBR

Copy link
Copy Markdown
Member

Related to #1209

Covers the Exceptions item of the v1.14.0 checklist. The 48 raise AssertionError in rocketpy/stochastic now raise StochasticTypeError (wrong type or format) or StochasticValueError (right type, invalid value), as asked in #1194. Both live in rocketpy.exceptions and also subclass TypeError/ValueError and AssertionError, so existing except AssertionError code keeps working; the messages are unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XDW575d9C9zpS7Z1v2KXVq

@Gui-FernandesBR
Gui-FernandesBR requested a review from a team as a code owner November 17, 2026 18:14
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.65%. Comparing base (9bf63a0) to head (611a304).

Files with missing lines Patch % Lines
rocketpy/stochastic/stochastic_model.py 50.00% 11 Missing ⚠️
rocketpy/stochastic/stochastic_rocket.py 40.00% 6 Missing ⚠️
rocketpy/stochastic/stochastic_aero_surfaces.py 90.00% 1 Missing ⚠️
rocketpy/stochastic/stochastic_environment.py 80.00% 1 Missing ⚠️
rocketpy/stochastic/stochastic_parachute.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1221      +/-   ##
===========================================
+ Coverage    86.55%   86.65%   +0.10%     
===========================================
  Files          131      131              
  Lines        18248    18256       +8     
===========================================
+ Hits         15794    15820      +26     
+ Misses        2454     2436      -18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@MateusStano

Copy link
Copy Markdown
Member

Looks good. One thing before merging: the commit adds three empty files at the repo root, which look like test outputs committed by accident:

  • monte_carlo_test.errors.txt
  • monte_carlo_test.inputs.txt
  • monte_carlo_test.outputs.txt

Can you remove them from the branch? After that I am fine with merging.

The stochastic validators raised AssertionError for every bad input, which
says nothing about whether the type or the value was wrong. They now raise
StochasticTypeError or StochasticValueError from rocketpy.exceptions, which
are also TypeError/ValueError and still AssertionError, so existing
`except AssertionError` code keeps working. Messages are unchanged.

Related to #1209.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDW575d9C9zpS7Z1v2KXVq
@Gui-FernandesBR
Gui-FernandesBR force-pushed the mnt/stochastic-exceptions branch from eecb254 to 611a304 Compare November 19, 2026 23:23
@Gui-FernandesBR Gui-FernandesBR mentioned this pull request Nov 20, 2026
4 of 11 tasks
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