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

increase coverage to 100% (test ALL AMBER files and all of __init__) #74

Merged
merged 2 commits into from
Sep 28, 2022

Conversation

orbeckst
Copy link
Member

@orbeckst orbeckst commented Sep 27, 2022

  • fix test AMBER data sets #49
  • test all untested AMBER data sets (custom tests (with hacked accessors)
    for the AMBER BACE example and invalidfiles)
  • test everything in __init__.py (Bunch and __version__)

@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #74 (31114d8) into master (6eda6eb) will increase coverage by 9.21%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
+ Coverage   90.13%   99.34%   +9.21%     
==========================================
  Files          11       11              
  Lines         152      152              
  Branches       19       19              
==========================================
+ Hits          137      151      +14     
+ Misses         15        1      -14     
Flag Coverage Δ
unittests 99.34% <ø> (+9.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/alchemtest/__init__.py 94.11% <0.00%> (+23.52%) ⬆️
src/alchemtest/amber/access.py 100.00% <0.00%> (+37.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

- fix #49
- add custom tests (with hacked accessors) for the AMBER BACE example
  and invalidfiles
@orbeckst
Copy link
Member Author

@xiki-tempula I added tests for all current AMBER files.

The ones for invalid files will change with PR #71 (and my hack can then be removed) but at least we now have a clear baseline. It also documents the non-API behavior of the BACE example.

Comment on lines +28 to +36
def _load_bace_example_complex():
dset = load_bace_example()
return Bunch(data=dset.data['complex'],
DESCR="BACE example: complex")

# class TestInvalidFiles(BaseDatasetTest):
# # can't get the list of list in data
# @pytest.fixture(scope="class",
# params = [(load_invalidfiles, (slice(None),), (6,)),
# ])
# def dataset(self, request):
# return super().dataset(request)
def _load_bace_example_solvated():
dset = load_bace_example()
return Bunch(data=dset.data['solvated'],
DESCR="BACE example: solvated")
Copy link
Member Author

Choose a reason for hiding this comment

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

There might be a way to reduce code duplication but I didn't see anything clean right away so I opted for clear copy&paste for what hopefully remains the single exception.

# use pytest.param to add the id for nicer pytest -v output
@pytest.fixture(scope="class",
params = [
pytest.param(
Copy link
Member Author

Choose a reason for hiding this comment

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

using param is not strictly necessary but I wanted to show how to make thr verbose output a bit clearer (instead of "dataset0" and "dataset1").

Comment on lines +60 to +71
def _load_labelled_invalidfiles():
dset = load_invalidfiles()
return Bunch(data={'invalid_files': dset.data[0]},
DESCR=dset.DESCR)

class TestInvalidFiles(BaseDatasetTest):
@pytest.fixture(scope="class",
params = [(_load_labelled_invalidfiles,
('invalid_files',), (6,)),
])
def dataset(self, request):
return super(TestInvalidFiles, self).dataset(request)
Copy link
Member Author

Choose a reason for hiding this comment

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

This should be superseded with PR #71 and then the load_testfiles() can be added to the TestAMBER class above.

- test Bunch
- test __version__
@orbeckst orbeckst changed the title test ALL AMBER files increase coverage to 100% (test ALL AMBER files and all of __init__) Sep 28, 2022
Copy link
Collaborator

@xiki-tempula xiki-tempula left a comment

Choose a reason for hiding this comment

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

LGTM

@orbeckst orbeckst merged commit d4a61d2 into master Sep 28, 2022
@orbeckst orbeckst deleted the test-all-amber branch September 28, 2022 14:53
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.

test AMBER data sets
2 participants