Add new options, normalization, and empty result checks in assertQueries().
Review Request #12367 — Created June 14, 2022 and submitted
This introduces the following new comparison keys in
limit- The value for a SQL
offset- The value for a SQL
values_select- Any fields passed to
It also does a few other things to fix and aid in comparisons.
Any values in
extra are now normalized. Whitespace is collapsed and
stripped. Unit tests no longer have to be aware of the exact formatting
of the SQL, which helps for more complex statements.
Queries that are generated but not executed (any that would raise a
EmptyResultSet) are now skipped for comparison. An example would be a
pk__in=, which Django knows makes no sense to pass to the
database. This is a way that code can short-circuit and optimize out an
entire query or a particular clause of the query in Django.
assertQueries() now ignores it just as Django does.
Made use of these in other unit tests.
I'm a little confused on this (particularly the Callers do not need to supply this default), maybe some rewording is …
Took another stab at describing the
Revision 2 (+234 -46)
Checks run (2 succeeded)
Much clearer now, looks good.