Improved error reporting and tests for prune_paths() methods#212
Merged
Improved error reporting and tests for prune_paths() methods#212
Conversation
Closes jni#206 The error arises during usage of the `csr.Skeleton.prune_paths()` which takes a list of indices from `csr.summarize()` which are to be pruned. If the index is outside of the range of rows in the data frame a `ValueError` is thrown. It was first highlighted during early development of pruning iteratively but can arise any time in inappropriate value that is greater than the number of paths in a skeleton is passed to `prune_path()` method. A `try: ... except: ...` is introduced to capture this and report, hopefully informatively, what the problem is and how to correct it. Tests are introduced for this method, parametrized to test removing different types of paths along with tests of two exceptions that can arise.
Owner
|
@ns-rse Thinking about this: I think we can catch early and fail: |
Thanks for the suggestion @jni
Contributor
Author
|
The @slackline account is my personal rather than work account sorry for the mistake. |
jni
reviewed
Oct 16, 2023
| [0, 3, 2, 0, 1, 1, 0], [3, 0, 0, 4, 0, 0, 0], | ||
| [3, 0, 0, 0, 4, 4, 4]]) | ||
| ), | ||
| ] |
Owner
There was a problem hiding this comment.
Eek, looks like I need to fiddle with my yapf config a bit more, I very much dislike this way of closing/matching parens... 😅 (Ignore this comment for this PR, just thinking out loud.)
jni
approved these changes
Oct 16, 2023
Owner
|
I've pushed a few changes, we can probably merge this live in a bit. 😊 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #206
The error arises during usage of
csr.Skeleton.prune_paths()which takes a list of indices, typical fromcsr.summarize(), which are to be pruned. If the index is outside of the range of rows in the data frame aValueErroris thrown.It was first highlighted during early development of pruning iteratively but can arise any time in inappropriate value that is greater than the number of paths in a skeleton is passed to
prune_path()method.A
try: ... except: ...is introduced to capture this and report, hopefully informatively, what the problem is and how to correct it. Tests are introduced for this method, parametrized to test removing different types of paths along with tests of two exceptions that can arise.