Fix showing output for non-sortable sets of values.

Review Request #14386 — Created March 21, 2025 and updated

Information

django-assert-queries
main

Reviewers

When showing output from a failed comparison where sets are involved, we
try to sort the values to provide consistent odering for comparison.
When doing this, we could hit an error saying that the values aren't
sortable, due to __lt__ not being implemented.

We now detect this case and sort by the representations of the values
instead.

All unit tests pass.

Verified this fixed issues encountered in some new unit tests in
Review Board.

Summary ID
Fix showing output for non-sortable sets of values.
When showing output from a failed comparison where sets are involved, we try to sort the values to provide consistent odering for comparison. When doing this, we could hit an error saying that the values aren't sortable, due to `__lt__` not being implemented. We now detect this case and sort by the representations of the values instead.
b8c5cddf83ebbeee54797c732c33562fbfbf5431
Description From Last Updated

local variable 'obj1' is assigned to but never used Column: 9 Error code: F841

reviewbotreviewbot

local variable 'obj2' is assigned to but never used Column: 9 Error code: F841

reviewbotreviewbot
There are no open issues
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Removed unused variables.

Commits:
Summary ID
Fix showing output for non-sortable sets of values.
When showing output from a failed comparison where sets are involved, we try to sort the values to provide consistent odering for comparison. When doing this, we could hit an error saying that the values aren't sortable, due to `__lt__` not being implemented. We now detect this case and sort by the representations of the values instead.
e4eec708c1f93d988dfd6e3470fb8de26845462b
Fix showing output for non-sortable sets of values.
When showing output from a failed comparison where sets are involved, we try to sort the values to provide consistent odering for comparison. When doing this, we could hit an error saying that the values aren't sortable, due to `__lt__` not being implemented. We now detect this case and sort by the representations of the values instead.
b8c5cddf83ebbeee54797c732c33562fbfbf5431
Diff:

Revision 2 (+52 -2)

Show changes

django_assert_queries/query_comparator.py
django_assert_queries/tests/test_query_comparator.py

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
maubin
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
Loading...