-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrected except KeyError
to except AttributeError
in TrajectoryData node methods.
#5015
Conversation
Co-Authored-By: Leopold Talirz <leopold.talirz@gmail.com>
Co-Authored-By: Leopold Talirz <leopold.talirz@gmail.com>
…d from node.get_attribute
Codecov Report
@@ Coverage Diff @@
## develop #5015 +/- ##
===========================================
+ Coverage 80.89% 80.91% +0.03%
===========================================
Files 536 536
Lines 37019 37019
===========================================
+ Hits 29944 29952 +8
+ Misses 7075 7067 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Hey @Crivella ! Thanks for the contribution and sorry for the long wait! I see that Codecov is complaining that there are not test for this, probably this contributed to us not noticing when this broke down. Would you be up for adding those? I would add a file in |
HI @ramirezfranciscof , I have added the test that checks if the same try_except statement in the show_mpl_* functions behave properly when the attribute are not found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Crivella ! Sorry the delay but I was looking if there was a way to monkeypatch plot_positions_XYZ
to write to a file or something like that and test that instead of the direct raising of get_attribute
, which is not optimal but I guess is the best we have so far.
Anyways, I think this can go in now and we can later improve moving to pytest or being more precise with the testing, but great base material!
In the TrajectoryData node there are several try checks on the get_attibute method, which except a KeyError in order then pick a default value/action.
KeyError
should be changed toAttributeError
as this is what the get_attribute method raises when the attribute is not found.