refactor tests/test_regex_identifier.py#202
refactor tests/test_regex_identifier.py#202bee-san merged 30 commits intobee-san:mainfrom jyooru:test/parametrize
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ghost
left a comment
There was a problem hiding this comment.
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.jsonand usingpytest.mark.parmaterizeto "generate" tests using the test data now inregex.json. This makes it much easier to maintaintest_regex_identifier.pyas to change all_assert_match_first_itemtests, 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!