'Ensure choices are set the selected class when using non-string values
for lookups in SimpleListFilters.
Refs #19318'

def test_lookup_with_non_string_value(self):

    modeladmin = DepartmentFilterEmployeeAdmin(Employee, site)
    request = self.request_factory.get(u'/', {u'department': self.john.pk})
    changelist = self.get_changelist(request, Employee, modeladmin)
    queryset = changelist.get_queryset(request)
    self.assertEqual(list(queryset), [self.john])
    filterspec = changelist.get_filters(request)[0][(-1)]
    self.assertEqual(force_text(filterspec.title), u'department')
    choices = list(filterspec.choices(changelist))
    self.assertEqual(choices[1][u'display'], u'DEV')
    self.assertEqual(choices[1][u'selected'], True)
    self.assertEqual(choices[1][u'query_string'], (u'?department=%s' % self.john.pk))
