-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
refactor tests/test_regex_identifier.py #202
Conversation
Codecov Report
@@ Coverage Diff @@
## main #202 +/- ##
==========================================
- Coverage 94.50% 92.32% -2.19%
==========================================
Files 14 14
Lines 1729 1198 -531
==========================================
- Hits 1634 1106 -528
+ Misses 95 92 -3
Continue to review full report at Codecov.
|
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.
Can you change "Matches" to "Examples"?
Yeah, I'm planing on also adding some strings that should not be matched. Does something like this sound alright? {
"Name": "Email Address",
...
"Examples": {
"Valid": ["firstname+lastname@example.com"],
"Invalid": ["email@example@example.com"]
}
} def test_email4():
res = r.check(["email@example@example.com"])
assert "Email Address" not in res |
Amazing |
This is great!! Makes it way easier for people to test their code, and it allows people in the future to see examples of things :D happy to merge this, 1 question -- why is code coverage down? 🤔 other than that, it looks good to me :D !!! 🥳 |
Thanks! Code coverage is down due to amount of lines of code removed, as pytest is practically just rerunning the function for each match. JSON does not contribute to coverage either. I will be checking that there is the same amount of test cases before and after, that way I know I haven't left anything out accidentally. |
Please squash! |
Can you change the codecov stuff slightly so it passes CI? :) |
⚠ Pull Requests not made with this template will be automatically closed 🔥
Prerequisites
Why do we need this pull request?
Currently, the tests files are quite long. I've attempted moving the test data into
regex.json
and usingpytest.mark.parmaterize
to "generate" tests using the test data now inregex.json
. This makes it much easier to maintaintest_regex_identifier.py
as to change all_assert_match_first_item
tests, you only have to change one test:What GitHub issues does this fix?
Related to #199
Related to #195
Contributions to this PR are welcome!