Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a dependence on set-ordering in tests

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

0 notes on commit 1ae64e9

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