Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.4.x] Fixed #20906 -- Fixed a dependence on set-ordering in tests

Backport of 1ae64e9 from master
  • Loading branch information...
commit d5da495a2edc741b6496821baa0d6bcee9dce9bb 1 parent bf611f1
Luke Plant authored December 24, 2012 timgraham committed August 16, 2013
11  tests/regressiontests/admin_filters/tests.py
@@ -82,11 +82,11 @@ class DepartmentListFilterLookupWithNonStringValue(SimpleListFilter):
82 82
     parameter_name = 'department'
83 83
 
84 84
     def lookups(self, request, model_admin):
85  
-        return set([
  85
+        return sorted(set([
86 86
             (employee.department.id,  # Intentionally not a string (Refs #19318)
87 87
              employee.department.code)
88 88
             for employee in model_admin.queryset(request).all()
89  
-        ])
  89
+        ]))
90 90
 
91 91
     def queryset(self, request, queryset):
92 92
         if self.value():
@@ -681,10 +681,9 @@ def test_lookup_with_non_string_value(self):
681 681
         filterspec = changelist.get_filters(request)[0][-1]
682 682
         self.assertEqual(force_unicode(filterspec.title), u'department')
683 683
         choices = list(filterspec.choices(changelist))
684  
-
685  
-        self.assertEqual(choices[2]['display'], u'DEV')
686  
-        self.assertEqual(choices[2]['selected'], True)
687  
-        self.assertEqual(choices[2]['query_string'], '?department=%s' % self.john.pk)
  684
+        self.assertEqual(choices[1]['display'], 'DEV')
  685
+        self.assertEqual(choices[1]['selected'], True)
  686
+        self.assertEqual(choices[1]['query_string'], '?department=%s' % self.john.pk)
688 687
 
689 688
     def test_fk_with_to_field(self):
690 689
         """

0 notes on commit d5da495

Please sign in to comment.
Something went wrong with that request. Please try again.