Skip to content
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

Add system and utils unit tests #34

Merged
merged 15 commits into from
Aug 30, 2023
Merged

Add system and utils unit tests #34

merged 15 commits into from
Aug 30, 2023

Conversation

marjanalbooyeh
Copy link
Collaborator

This PR adds more tests for the following modules:

1- All the setter methods for reference values in System base class. Cases with ReferenceUnitError are being tested too.

2- ScaleEpsilon and ScaleSigma in utils actions.

3- xml_to_gmso_ff in ff_utils.

@chrisjonesBSU
Copy link
Member

chrisjonesBSU commented Aug 29, 2023

@marjanAlbouye While we're making some small changes to the reference units attributes and setters, what do you think about adding a check for the correct dimensions?

Unyt units have a dimensions parameter that return (mass), (length) the dimensions for energy is (length)**2*(mass)/(time)**2

For example, we should throw an error if someone tries setting reference_length to a unit that doesn't have dimensions of (length)

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #34 (006c838) into main (bb841e0) will increase coverage by 2.20%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   89.17%   91.38%   +2.20%     
==========================================
  Files          18       18              
  Lines        1303     1312       +9     
==========================================
+ Hits         1162     1199      +37     
+ Misses        141      113      -28     
Files Changed Coverage Δ
hoomd_organics/base/system.py 88.75% <100.00%> (+6.83%) ⬆️

... and 4 files with indirect coverage changes

@marjanalbooyeh marjanalbooyeh linked an issue Aug 29, 2023 that may be closed by this pull request
@marjanalbooyeh
Copy link
Collaborator Author

@chrisjonesBSU
I added some checks in system.py to make sure the reference units have correct dimensions. Unit tests have been added accordingly.

@marjanalbooyeh
Copy link
Collaborator Author

ToDo for me: Move all the checks related to units and their dimensions to utils to avoid having duplicated code. Also, allow unit strings with / character such as "kcal/mol".

@chrisjonesBSU
Copy link
Member

ToDo for me: Move all the checks related to units and their dimensions to utils to avoid having duplicated code. Also, allow unit strings with / character such as "kcal/mol".

Do you want to do that in this PR, or merge this and make a separate PR that streamlines the reference unit setters?

@marjanalbooyeh
Copy link
Collaborator Author

ToDo for me: Move all the checks related to units and their dimensions to utils to avoid having duplicated code. Also, allow unit strings with / character such as "kcal/mol".

Do you want to do that in this PR, or merge this and make a separate PR that streamlines the reference unit setters?

I was planning to do it in this PR but this PR is getting big. I'll merge this one and start a new one.

@marjanalbooyeh marjanalbooyeh merged commit a714ac2 into cmelab:main Aug 30, 2023
1 check passed
@marjanalbooyeh marjanalbooyeh mentioned this pull request Aug 30, 2023
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.

Finish unit tests
2 participants