def test_lookup_with_non_string_value_underscored(self):
        modeladmin = DepartmentFilterUnderscoredEmployeeAdmin(Employee, site)
        request = self.request_factory.get('/', {'department__whatever': self.john.department.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), 'department')
        choices = list(filterspec.choices(changelist))
        self.assertEqual(choices[1]['display'], 'DEV')
        self.assertEqual(choices[1]['selected'], True)
        self.assertEqual(choices[1]['query_string'], '?department__whatever=%s' % self.john.department.pk)
Ensure SimpleListFilter lookups pass lookup_allowed checks when
dataset/ETHPy150Open django/django/tests/admin_filters/tests.py/ListFiltersTests.test_lookup_with_non_string_value_underscored