Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[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
@spookylukey spookylukey authored timgraham committed
Showing with 5 additions and 6 deletions.
  1. +5 −6 tests/regressiontests/admin_filters/tests.py
View
11 tests/regressiontests/admin_filters/tests.py
@@ -82,11 +82,11 @@ class DepartmentListFilterLookupWithNonStringValue(SimpleListFilter):
parameter_name = 'department'
def lookups(self, request, model_admin):
- return set([
+ return sorted(set([
(employee.department.id, # Intentionally not a string (Refs #19318)
employee.department.code)
for employee in model_admin.queryset(request).all()
- ])
+ ]))
def queryset(self, request, queryset):
if self.value():
@@ -681,10 +681,9 @@ def test_lookup_with_non_string_value(self):
filterspec = changelist.get_filters(request)[0][-1]
self.assertEqual(force_unicode(filterspec.title), u'department')
choices = list(filterspec.choices(changelist))
-
- self.assertEqual(choices[2]['display'], u'DEV')
- self.assertEqual(choices[2]['selected'], True)
- self.assertEqual(choices[2]['query_string'], '?department=%s' % self.john.pk)
+ self.assertEqual(choices[1]['display'], 'DEV')
+ self.assertEqual(choices[1]['selected'], True)
+ self.assertEqual(choices[1]['query_string'], '?department=%s' % self.john.pk)
def test_fk_with_to_field(self):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.