#33609: Use assertCountEqual in assertQuerysetEqual
-------------------------------------+-------------------------------------
               Reporter:  David      |          Owner:  nobody
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Testing    |        Version:  dev
  framework                          |
               Severity:  Normal     |       Keywords:  queryseteuql
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 As of now the assertQueryEqual method
 
[[https://github.com/django/django/blob/04ad0f26ba4b8c79dc311e1789457e0c4d1b8832/django/test/testcases.py#L1240-L1241|ueses
 counters to compare unordered Querysets]], in the standard unittest
 package there is already such method called
 
[[https://docs.python.org/3/library/unittest.html?highlight=assertcountequal#unittest.TestCase.assertCountEqual|assertCountEqual]],
 which also has better output-formatting capability.

 {{{#!python
 self.assertCountEqual(items, values, msg=msg)
 }}}

 Using data from current test it will output:

 {{{
 Element counts were not equal:
 First has 0, Second has 1:  'Extra Person'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33609>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107017fdb21cae9-d1eb9fa6-7ddf-4e8d-a7f4-8a786603a714-000000%40eu-central-1.amazonses.com.

Reply via email to