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 first tests module and file indexing system #54

Merged
merged 24 commits into from
Jul 26, 2023
Merged

Conversation

dachengx
Copy link
Collaborator

@dachengx dachengx commented Jul 22, 2023

Trying to solve #22

What does the code in this PR do / what does it improve?

Add unittest for GaussianModel, TemplateSource, Parameters, CustomAncillaryLikelihood, and BlueiceExtendedModel.

The usage of get_file_path:

from alea.utils import get_file_path
get_file_path('unbinned_wimp_statistical_model.yaml')

get_file_path('unbinned_wimp_running.yaml', ['/home/***/alea/alea/runner_configs'])

output:

'/home/***/alea/alea/model_configs/unbinned_wimp_statistical_model.yaml'

INFO:root:Load unbinned_wimp_running.yaml successfully from /home/***/alea/alea/runner_configs/unbinned_wimp_running.yaml
'/home/***/alea/alea/runner_configs/unbinned_wimp_running.yaml'

Can you briefly describe how it works?

Can you give a minimal working example (or illustrate with a figure)?

What are the potential drawbacks of the codes?

Please include the following if applicable:

  • Update the docstring(s)
  • Update the documentation
  • Tests to check the (new) code is working as desired.
  • Does it solve one of the open issues on github?

Notes on testing

  • Until the automated tests pass, please mark the PR as a draft.

All italic comments can be removed from this template.

tests/test_statistical_model.py Outdated Show resolved Hide resolved
tests/test_statistical_model.py Outdated Show resolved Hide resolved
tests/test_statistical_model.py Outdated Show resolved Hide resolved
tests/test_statistical_model.py Outdated Show resolved Hide resolved
tests/test_statistical_model.py Outdated Show resolved Hide resolved
tests/test_parameter.py Show resolved Hide resolved
tests/test_parameter.py Show resolved Hide resolved
tests/test_template_source.py Show resolved Hide resolved
tests/test_template_source.py Show resolved Hide resolved
alea/__init__.py Outdated Show resolved Hide resolved
@dachengx dachengx changed the title Add tests of blueice_extended_model Add first tests module Jul 22, 2023
@github-actions
Copy link

github-actions bot commented Jul 22, 2023

Pull Request Test Coverage Report for Build 5660974185

  • 60 of 78 (76.92%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+17.6%) to 17.629%

Changes Missing Coverage Covered Lines Changed/Added Lines %
alea/model.py 7 8 87.5%
alea/models/blueice_extended_model.py 18 20 90.0%
alea/template_source.py 2 9 22.22%
alea/utils.py 28 36 77.78%
Files with Coverage Reduction New Missed Lines %
alea/template_source.py 1 7.17%
Totals Coverage Status
Change from base Build 5655453593: 17.6%
Covered Lines: 513
Relevant Lines: 2910

💛 - Coveralls

@dachengx dachengx marked this pull request as ready for review July 25, 2023 03:18
tests/test_blueice_extended_model.py Outdated Show resolved Hide resolved
alea/utils.py Show resolved Hide resolved
alea/utils.py Outdated Show resolved Hide resolved
alea/utils.py Outdated Show resolved Hide resolved
alea/models/blueice_extended_model.py Outdated Show resolved Hide resolved
tests/test_blueice_extended_model.py Show resolved Hide resolved
tests/test_gaussian_model.py Outdated Show resolved Hide resolved
tests/test_template_source.py Show resolved Hide resolved
tests/test_template_source.py Outdated Show resolved Hide resolved
alea/model.py Show resolved Hide resolved
alea/model.py Outdated Show resolved Hide resolved
alea/parameters.py Show resolved Hide resolved
alea/models/blueice_extended_model.py Show resolved Hide resolved
@dachengx dachengx changed the title Add first tests module Add first tests module and file indexing system Jul 25, 2023
alea/__init__.py Show resolved Hide resolved
alea/template_source.py Show resolved Hide resolved
alea/models/blueice_extended_model.py Outdated Show resolved Hide resolved
@dachengx dachengx requested review from kdund and hammannr July 25, 2023 09:59
Copy link
Collaborator

@hammannr hammannr left a comment

Choose a reason for hiding this comment

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

Very nice first unittests for alea, thanks a lot @dachengx ! 😊 There are a few things I'm not entirely sure about when it comes to the other changes, maybe we can discuss them here.

alea/parameters.py Show resolved Hide resolved
alea/models/blueice_extended_model.py Show resolved Hide resolved
tests/test_blueice_extended_model.py Outdated Show resolved Hide resolved
tests/test_statistical_model.py Outdated Show resolved Hide resolved
@dachengx dachengx added testing Works on testing code robustness Make the code more robust labels Jul 25, 2023
tests/test_gaussian_model.py Show resolved Hide resolved
tests/test_gaussian_model.py Show resolved Hide resolved
tests/test_gaussian_model.py Show resolved Hide resolved
tests/test_gaussian_model.py Show resolved Hide resolved
tests/test_gaussian_model.py Outdated Show resolved Hide resolved
tests/test_model.py Show resolved Hide resolved
tests/test_model.py Show resolved Hide resolved
@dachengx
Copy link
Collaborator Author

Finally, the review dog is happy. Happy dog!

Copy link
Collaborator

@kdund kdund left a comment

Choose a reason for hiding this comment

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

Thanks, @dachengx do you have any simple demonstration of the resource location script?

alea/__init__.py Outdated Show resolved Hide resolved
alea/models/blueice_extended_model.py Show resolved Hide resolved
alea/model.py Show resolved Hide resolved
alea/models/blueice_extended_model.py Show resolved Hide resolved
alea/models/blueice_extended_model.py Outdated Show resolved Hide resolved
alea/utils.py Outdated Show resolved Hide resolved
alea/utils.py Outdated Show resolved Hide resolved
@dachengx
Copy link
Collaborator Author

dachengx commented Jul 26, 2023

The usage of get_file_path is updated in the PR description. @kdund

Copy link
Collaborator

@kdund kdund left a comment

Choose a reason for hiding this comment

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

Thanks, @dachengx it now looks v nice to me
lets pytest till we drop!

@dachengx dachengx merged commit aee4080 into main Jul 26, 2023
@dachengx dachengx deleted the init_unittest branch July 26, 2023 16:33
@coveralls
Copy link

coveralls commented Dec 4, 2024

Pull Request Test Coverage Report for Build 5660974185

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 53 of 70 (75.71%) changed or added relevant lines in 6 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+17.6%) to 17.629%

Changes Missing Coverage Covered Lines Changed/Added Lines %
alea/model.py 7 8 87.5%
alea/models/blueice_extended_model.py 13 14 92.86%
alea/template_source.py 2 9 22.22%
alea/utils.py 27 35 77.14%
Files with Coverage Reduction New Missed Lines %
alea/template_source.py 1 7.17%
alea/models/blueice_extended_model.py 3 92.52%
Totals Coverage Status
Change from base Build 5655453593: 17.6%
Covered Lines: 513
Relevant Lines: 2910

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
robustness Make the code more robust testing Works on testing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants