Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27203 closed Cleanup/optimization (fixed)

Update tests that use assertQuerysetEqual lambda o: o to use assertSequenceEqual

Reported by: Tim Graham Owned by: nobody
Component: Core (Other) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

For example:

  • tests/expressions/tests.py

    diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
    index 27929c9..459d317 100644
    a b class BasicExpressionsTests(TestCase):  
    9494        # We can set one field to have the value of another field
    9595        # Make sure we have enough chairs
    9696        self.company_query.update(num_chairs=F("num_employees"))
    97         self.assertQuerysetEqual(
     97        self.assertSequenceEqual(
    9898            self.company_query, [
    9999                {
    100100                    "num_chairs": 2300,
    class BasicExpressionsTests(TestCase):  
    112112                    "num_employees": 32
    113113                }
    114114            ],
    115             lambda o: o
    116115        )
    117116
    118117    def test_arithmetic(self):

When searching for cases to replace, there might be other letters besides 'o' in lambda o: o.

Change History (3)

comment:1 by Tim Graham, 8 years ago

Has patch: set
Patch needs improvement: set

PR but it only replaces lambda o: o and not other letters that might be used in the expression.

comment:2 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 0c1f716:

Fixed #27203 -- Replaced assertQuerysetEqual(..., lambda o: o) with assertSequenceEqual().

comment:3 by Tim Graham <timograham@…>, 8 years ago

In 0627858a:

Fixed a couple ordering dependent tests on Oracle broken by refs #27203.

Note: See TracTickets for help on using tickets.
Back to Top