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

Move reference values unit validation to utils #36

Merged
merged 18 commits into from
Aug 30, 2023
Merged

Move reference values unit validation to utils #36

merged 18 commits into from
Aug 30, 2023

Conversation

marjanalbooyeh
Copy link
Collaborator

This PR moves a bunch of duplicated codes that validates reference units to the utils module.
Unit tests have been added for all new functionalities.

@marjanalbooyeh marjanalbooyeh marked this pull request as ready for review August 30, 2023 19:43
@chrisjonesBSU
Copy link
Member

Thanks for doing this!

It looks like there might be a typo in one of the unit tests:

     def test_ref_energy_invalid_dimension_string(self, polyethylene):
        polyethylene = polyethylene(lengths=5, num_mols=1)
        system = Pack(
            molecules=[polyethylene],
            force_field=[OPLS_AA()],
            density=1.0,
            r_cut=2.5,
            auto_scale=False,
        )
        with pytest.raises(ReferenceUnitError):
>           system.reference_length = "1.0 m"
E           Failed: DID NOT RAISE <class 'hoomd_organics.utils.exceptions.ReferenceUnitError'>

Looks like system.reference_length is supposed to be system.reference_energy ?

Copy link
Member

@chrisjonesBSU chrisjonesBSU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once that last unit test passes :) Thanks!

@marjanalbooyeh marjanalbooyeh merged commit 165fc3f into cmelab:main Aug 30, 2023
2 checks passed
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #36 (1cd1300) into main (4b46d69) will increase coverage by 0.18%.
Report is 19 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
+ Coverage   92.04%   92.23%   +0.18%     
==========================================
  Files          18       18              
  Lines        1320     1326       +6     
==========================================
+ Hits         1215     1223       +8     
+ Misses        105      103       -2     
Files Changed Coverage Δ
hoomd_organics/base/system.py 88.66% <100.00%> (-1.12%) ⬇️
hoomd_organics/utils/__init__.py 100.00% <100.00%> (ø)
hoomd_organics/utils/utils.py 100.00% <100.00%> (+20.00%) ⬆️

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