-
Notifications
You must be signed in to change notification settings - Fork 384
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
Add unittests for models #1416
Add unittests for models #1416
Conversation
8d0dade
to
32a36de
Compare
Codecov Report
@@ Coverage Diff @@
## master #1416 +/- ##
==========================================
+ Coverage 37.92% 45.62% +7.69%
==========================================
Files 198 207 +9
Lines 11337 11872 +535
==========================================
+ Hits 4300 5417 +1117
+ Misses 7037 6455 -582
Continue to review full report at Codecov.
|
fc08a80
to
f82908b
Compare
Todo:
|
e8e22d0
to
f530d65
Compare
1e79d70
to
c54d442
Compare
5bacadf
to
02bdbc3
Compare
This PR covers unittests for most of the models. Models excluded:
|
ffc9bb8
to
c20ec28
Compare
e897018
to
b8ab7fb
Compare
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.
Otherwise looks great!
judge/models/tests/test_contest.py
Outdated
|
||
def test_basic_contest(self): | ||
self.assertTrue(self.basic_contest.show_scoreboard) | ||
self.assertIsInstance(self.basic_contest.contest_window_length, timezone.timedelta) |
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.
Why not assert the actual values?
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.
Done for this (since the timedelta
is fixed). However, I don't think we should assert the actual values for the ones that are dependant on the current time (e.g time_remaining)
.
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.
Could you not get an accurate calculation by using the Contest's _now
cached property?
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.
Personally, I don't think it is worth it to check for the exact match in these cases. If you're using the Contest's _now
property, you basically end up rewriting that method's calculation as a test, which doesn't really test what the method "should" return.
b8ab7fb
to
2380f2f
Compare
0f1c76b
to
185eed7
Compare
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.
LGTM
No description provided.