This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
test functions for validate_mesh_structure_pairs #114
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7227e2d
first test functions for validate_mesh_structure_pairs
viktorpm 3a7dfc8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9a3e455
adding docstring
viktorpm 8ac70cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 38fd53e
writing docstrings to explain the behaviour of the test functions
viktorpm 813d84f
validate_atlases.py: updated validate_mesh_structure_pairs function, …
viktorpm 86017a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 94e8704
spliting validate_mesh_structure_pairs function, checking mesh files …
viktorpm c2bd401
writing tests for catch_missing_mesh_files and catch_missing_structur…
viktorpm 6528f6a
creating an atlas with a missing structure to test catch_missing_stru…
viktorpm 972b0d6
Update tests/test_unit/test_validation.py
viktorpm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't understand this. Some thoughts:
pytest.raises
checks whether a function in the source code raises an error in the expected case - it doesn't raise an error itself (the name is slightly confusing).catch_missing_structures
functionatlas
with missing structures tocatch_missing_structures
- one that we expect to raise the expected error - so we can check thatcatch_missing_structures
works as expected.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.
Thanks @alessandrofelder for clarifying this! I was overcomplicating it a bit in my head :)
So can I just mock an atlas with a missing structure and pass that to the test function?
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.
Indeed. You may not even need to use the mocking framework to do this. You can remove a key-value-pair from the
atlas.structures
dict.I would formulate this as "create it in the test function and pass it to the tested function".