flake8
-
djblets/testing/testcases.py (Diff revision 1) Show all issues
Review Request #13402 — Created Nov. 6, 2023 and submitted
This reworks query comparison in
compare_queries()
and
assertQueries()
to track and compare nested subqueries. Queries now
support asubqueries
field, which follows the same format of the main
expected queries list, and this can be nested as deeply as required for
the queries being executed.Any subquery inside of a
where
filter (viaSubquery()
orExists()
)
will be transformed into aQ(__SubqueryType__subquery__=index)
query,
since this allows for direct comparison and equates to an index within
the nested query comparison list.The recent support for
inner_query
has been removed in favor of this
new support. Support is opt-in currently forassertQueries()
, to
maintain backwards-compatibility, but will be enabled by default in
Djblets 5.The normalization and formatting support has been enhanced to support
subqueries and F-expressions, and to display the way the code would be
written in Python withQ(...)
,F(...)
, etc. This makes it far easier
to compare and update queries.
Unit tests pass.
Tested this with in-progress code in Review Board.
Summary | ID |
---|---|
57ba205b1bf983de9b02ec504d56d0edebe9c182 |
Removed an unused import.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+3702 -444) |
Added some missing modifications to
assertQueries()
for somecompare_queries()
changes.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+3730 -494) |
Fixed reporting mismatched subqueries when the parent query's attributes matched.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+3740 -494) |
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+3852 -504) |
djblets/db/query_comparator.py (Diff revision 5) |
---|
Can get rid of this first paragraph since we say the same thing in the 2nd paragraph.
Removed an extra unnecessary paragraph in a description.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+3848 -508) |