mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #33476 -- Refactored code to strictly match 88 characters line length.
This commit is contained in:
@@ -88,19 +88,28 @@ class GetObjectOr404Tests(TestCase):
|
||||
def test_bad_class(self):
|
||||
# Given an argument klass that is not a Model, Manager, or Queryset
|
||||
# raises a helpful ValueError message
|
||||
msg = "First argument to get_object_or_404() must be a Model, Manager, or QuerySet, not 'str'."
|
||||
msg = (
|
||||
"First argument to get_object_or_404() must be a Model, Manager, or "
|
||||
"QuerySet, not 'str'."
|
||||
)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
get_object_or_404("Article", title__icontains="Run")
|
||||
|
||||
class CustomClass:
|
||||
pass
|
||||
|
||||
msg = "First argument to get_object_or_404() must be a Model, Manager, or QuerySet, not 'CustomClass'."
|
||||
msg = (
|
||||
"First argument to get_object_or_404() must be a Model, Manager, or "
|
||||
"QuerySet, not 'CustomClass'."
|
||||
)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
get_object_or_404(CustomClass, title__icontains="Run")
|
||||
|
||||
# Works for lists too
|
||||
msg = "First argument to get_list_or_404() must be a Model, Manager, or QuerySet, not 'list'."
|
||||
msg = (
|
||||
"First argument to get_list_or_404() must be a Model, Manager, or "
|
||||
"QuerySet, not 'list'."
|
||||
)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
get_list_or_404([Article], title__icontains="Run")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user