-
Notifications
You must be signed in to change notification settings - Fork 314
Correct STASH regular expression #2638
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8e02c7a
Correct STASH regular expression
ehogan 44b9c79
Revert "Correct STASH regular expression"
ehogan bfa7b88
Add test to show failure of current STASH regular expression
ehogan 58bf91f
Correct STASH regular expression
ehogan e97a314
Update STASH-related tests accordingly
ehogan 506c6d3
Restore a irregular STASH test
ehogan 38d91c0
Update regular expression to handle question marks for the model number
ehogan fe3fd3c
Changes in response to review: update format for illegal_stash tests,…
ehogan 5317a5a
Relax regex to allow varying lengths and reinstate tests
djkirkham 84468cb
Merge pull request #1 from djkirkham/correct_stash_regex
ehogan 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 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
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
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.
So I realise that this isn't directly your problem as you've copied an existing pattern, it's just the pattern you've copied is quite unusual... What this is doing is using one of the
unittestassertions to catch an error raised by anotherunittestassertion 😱I would prefer to see something like the following in all of these cases:
(give or take - I haven't tested this code!)
There are two changes here:
self.assertEqualand replaced it with a pure Python equality checkself.assertRaiseswith the preferred (and more robust)self.assertRaisesRegexpand added the expected regular expression failure. This tests that the right error has been raised, and that this test isn't throwing a false positive failure.