flake8
-
reviewboard/reviews/tests/test_review_request_draft.py (Diff revision 1) Show all issues -
reviewboard/reviews/tests/test_review_request_draft.py (Diff revision 1) E501 line too long (80 > 79 characters)
Review Request #11989 — Created Jan. 24, 2022 and submitted
Information | |
---|---|
david | |
Review Board | |
master | |
Reviewers | |
reviewboard | |
Using the assignment operator for setting the far side of a relation
such asManyToManyField
orForeignKey
now generates an error
instructing us to use.set()
instead.In many cases, we were using
.set()
to set a list of relations on
newly-created objects within tests. In these cases, we can save one
query per use by using.add()
instead.
Ran unit tests.
reviewboard/reviews/tests/test_review_request_draft.py (Diff revision 1) |
---|
reviewboard/reviews/tests/test_review_request_draft.py (Diff revision 1) |
---|
E501 line too long (80 > 79 characters)
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+334 -280) |
Purely optional work (because I'm sure you're really hoping for more things to do), but something that's stood out for a long time (and this would feel like the right time to fix it) is that our unit tests are using
=
(or now.set()
) when the probably shouldn't.
=/set()
will first delete all entries on the relation and then replace them. This is one more SQL query than we usually need in tests. We could (ever so slightly) speed up the test suite by using.add()
instead in most cases.But I'm also fine not worrying about it at all for this change. Mostly putting that out there and on the radar.
Description: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commits: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 3 (+326 -310) |