Skip to content

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

Merged
Gui-FernandesBR merged 3 commits into
developfrom
mnt/stochastic-exceptions
Nov 22, 2026
Merged

Gui-FernandesBR merged 3 commits 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 73.61111% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.86%. Comparing base (c09b3e0) to head (cb9130b).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/stochastic/stochastic_model.py 56.00% 11 Missing ⚠️
rocketpy/stochastic/stochastic_rocket.py 53.84% 6 Missing ⚠️
rocketpy/stochastic/stochastic_aero_surfaces.py 90.00% 1 Missing ⚠️
rocketpy/stochastic/stochastic_parachute.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1221      +/-   ##
===========================================
+ Coverage    86.71%   86.86%   +0.14%     
===========================================
  Files          131      131              
  Lines        18292    18307      +15     
===========================================
+ Hits         15862    15902      +40     
+ Misses        2430     2405      -25     

☔ 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.

@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
7 of 11 tasks
@Gui-FernandesBR
Gui-FernandesBR force-pushed the mnt/stochastic-exceptions branch from 611a304 to be07cd1 Compare November 21, 2026 13:16
@Gui-FernandesBR

Copy link
Copy Markdown
Member Author

Removed the three monte_carlo_test.*.txt files in fd10099. 8aacf9d also finishes the type/value split for a few checks that were still misclassified (wrong-type list members, empty trigger list) and converts the last plain TypeErrors in StochasticRocket/StochasticFlight, with tests asserting the specific class.

Gui-FernandesBR and others added 3 commits November 21, 2026 22:23
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
Wrong types in the positive-int list, ensemble members and parachute
trigger now raise StochasticTypeError, and an empty trigger list raises
StochasticValueError. The last plain TypeErrors in StochasticRocket and
StochasticFlight become StochasticTypeError, and the tests assert the
specific class for each of these sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDW577mr8JSrJHguXrmXzw
@Gui-FernandesBR
Gui-FernandesBR force-pushed the mnt/stochastic-exceptions branch from 8aacf9d to cb9130b Compare November 22, 2026 01:23
@Gui-FernandesBR
Gui-FernandesBR merged commit 8f55463 into develop Nov 22, 2026
8 checks passed
@Gui-FernandesBR
Gui-FernandesBR deleted the mnt/stochastic-exceptions branch November 22, 2026 01:23
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