Move the assertQueries comparison code into a dedicated module.
Review Request #13396 — Created Nov. 2, 2023 and submitted
This introduces
djblets.db.query_comparator
, which contains the query
comparison code fromassertQueries()
. This was moved out in order to
help make the code more maintainable, as it will soon need to grow in
size in order to handle ORM sub-expressions, and it was already pretty
large to begin with.Since we're starting fresh, some renames were made. Instead of
"failures", we now describe results in terms of "mismatches", to help
differentiate from a query that fails to execute.The inner functions have been made outer functions, avoiding the need to
redefine them when asserting.Otherwise, nothing has really changed about the assertion logic. This
merely lays the groundwork for upcoming work on comparisons.
assertQueries()
has been updated to use this, and has reduced in size
considerably.Given some of the renames, this does break typing compatibility with
newer code, but not with anything that has been released. The affected
code will be updated to use the new type imports.
Unit tests pass.
Summary | ID |
---|---|
d964531a39a993ac75aa55bf8fcf44a10f73b93f |
Description | From | Last Updated |
---|---|---|
Typo in description: "login" -> "logic" |
maubin |
- Change Summary:
-
Renamed some variables to fit the new naming and fixed some keys.
- Commits:
-
Summary ID e9ce2f1f9ee0b9fd680834d325df5ca201db8c4a d964531a39a993ac75aa55bf8fcf44a10f73b93f
Checks run (2 succeeded)
- Description:
-
This introduces
djblets.db.query_comparator
, which contains the querycomparison code from assertQueries()
. This was moved out in order tohelp make the code more maintainable, as it will soon need to grow in size in order to handle ORM sub-expressions, and it was already pretty large to begin with. Since we're starting fresh, some renames were made. Instead of
"failures", we now describe results in terms of "mismatches", to help differentiate from a query that fails to execute. The inner functions have been made outer functions, avoiding the need to
redefine them when asserting. ~ Otherwise, nothing has really changed about the assertion login. This
~ Otherwise, nothing has really changed about the assertion logic. This
merely lays the groundwork for upcoming work on comparisons. assertQueries()
has been updated to use this, and has reduced in sizeconsiderably. Given some of the renames, this does break typing compatibility with
newer code, but not with anything that has been released. The affected code will be updated to use the new type imports.