mirror of
https://github.com/django/django.git
synced 2025-11-18 02:56:45 +00:00
Updated the test to handle memoryview.
This commit is contained in:
parent
e01aeed772
commit
9a45e58673
1 changed files with 7 additions and 3 deletions
|
|
@ -2073,7 +2073,7 @@ class ListFiltersTests(TestCase):
|
||||||
try:
|
try:
|
||||||
choice = select_by(choices, "display", str(datas))
|
choice = select_by(choices, "display", str(datas))
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
raise IndexError(f"IndexError: {e}, choices={choices}")
|
raise IndexError(f"{e}, choices={choices}")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
choice["query_string"],
|
choice["query_string"],
|
||||||
"?datas=%s" % (quote(str(datas)),),
|
"?datas=%s" % (quote(str(datas)),),
|
||||||
|
|
@ -2087,8 +2087,12 @@ class ListFiltersTests(TestCase):
|
||||||
filter_changelist = filter_modeladmin.get_changelist_instance(filter_request)
|
filter_changelist = filter_modeladmin.get_changelist_instance(filter_request)
|
||||||
queryset = filter_changelist.get_queryset(filter_request)
|
queryset = filter_changelist.get_queryset(filter_request)
|
||||||
result = list(queryset)
|
result = list(queryset)
|
||||||
self.assertEqual(len(result), 1)
|
result_datas = (
|
||||||
self.assertEqual(result[0].datas, datas)
|
result[0].datas.tobytes()
|
||||||
|
if isinstance(result[0].datas, memoryview)
|
||||||
|
else result[0].datas
|
||||||
|
)
|
||||||
|
self.assertEqual(result_datas, datas)
|
||||||
|
|
||||||
|
|
||||||
class FacetsMixinTests(SimpleTestCase):
|
class FacetsMixinTests(SimpleTestCase):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue