-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unit tests upgrade. #145
Unit tests upgrade. #145
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
+ Coverage 33.40% 35.94% +2.54%
==========================================
Files 68 69 +1
Lines 3739 3836 +97
==========================================
+ Hits 1249 1379 +130
+ Misses 2490 2457 -33 ☔ View full report in Codecov by Sentry. |
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.
Generally LGTM, @jkbmrz could you take a look as well
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.
Generally LGTM! Adding some non-blocking comments and suggesting a small stylistic change:
We could increase readability of the tests by defining the correct argument values as variables instead of re-defining them anew for each test function. For example, we could change:
def test_invalid_keypoints_type():
with pytest.raises(ValueError):
create_detection_message(
np.array([[0.5, 0.5, 0.2, 0.2]]), np.array([0.9]), keypoints=[[[0.1, 0.1]]]
)
to:
BBOXES = np.array([[0.5, 0.5, 0.2, 0.2]])
SCORES = np.array([0.9])
def test_invalid_keypoints_type():
with pytest.raises(ValueError):
create_detection_message(
BBOXES, SCORES, keypoints=[[[0.1, 0.1]]]
)
and re-use the defined variables throughout the tests.This would increase the readability as the the reader could better focus on the tested values (and ignore the correct ones).
): | ||
create_image_message(img) | ||
|
||
def test_valid_chw_bgr(): |
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.
Same here and above, I think we could simplify these tests and have the assert checks in one test function only.
@jkbmrz thanks for detailed review. I fixed your suggestions and added global variables so we dont define vars inside each test. |
This PR refactors creators unit tests and updates the unit tests with the tests for message types. Unittests folder is now structured like:
I cleaned the creators tests and did some changes so they follow the creator functions. Newly added unittests for message types extends our CI testing.