-
Notifications
You must be signed in to change notification settings - Fork 230
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
BugFix: Empty list as val in RMGObject.as_dict() and .make_object() #1540
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1540 +/- ##
=======================================
Coverage 42.02% 42.02%
=======================================
Files 165 165
Lines 27867 27867
Branches 5680 5680
=======================================
Hits 11711 11711
Misses 15371 15371
Partials 785 785 Continue to review full report at Codecov.
|
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.
Looks good!
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.
Actually, could you add a simple unit test?
I added a new test module for RMG object. One of the tests is actually failing, which I'm glad was caught. If the value is a numpy array, then directly checking the truth value is ambiguous and raises an exception. |
Great catch! Thanks for adding this test |
The fix looks good! You can go ahead and squash. |
Don't bother dumping and parsing empty objects (usually an empty list)
done! |
Motivation or Problem
When RMGObject encounters an empty list, it cannot index it (e.g., call
val[0]
). This occures when running atomic species where the frequencies are just an empty list[]
.Description of Changes
We shouldn't bother dumping and parsing empty lists, they will get their default values when loading the object.
Testing
Files for testing (for carbon atom) are attached
C_arkane_input.txt
input.txt
sp.txt
Reviewer Tips
After successfully generating a YAML file for C, try feeding that YAML file back to Arkane to see that it reads it correctly.