diff options
author | Claude Paroz <claude@2xlibre.net> | 2016-03-27 22:35:57 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2016-03-29 21:34:20 +0200 |
commit | 12ba20d83c8faa51823e1471ab35fb46688ca577 (patch) | |
tree | 431e254eb2338cbf17603827be837ae916d5836e /tests/get_object_or_404 | |
parent | 4b2cf1cd27587a30b3b081091627d7ee13141afe (diff) | |
download | django-12ba20d83c8faa51823e1471ab35fb46688ca577.tar.gz |
Fixed #10532 -- Relaxed hard-type checking in get_object/list_or_404 shortcuts
Thanks Anssi Kääriäinen for the patch suggestion, and Tim Graham for the review.
Diffstat (limited to 'tests/get_object_or_404')
-rw-r--r-- | tests/get_object_or_404/tests.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/get_object_or_404/tests.py b/tests/get_object_or_404/tests.py index ac4b2d4738..bf10ea3109 100644 --- a/tests/get_object_or_404/tests.py +++ b/tests/get_object_or_404/tests.py @@ -81,18 +81,18 @@ 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 = "Object is of type 'str', but must be a Django Model, Manager, or QuerySet" + 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(str("Article"), title__icontains="Run") class CustomClass(object): pass - msg = "Object is of type 'CustomClass', but must be a Django Model, Manager, or QuerySet" + 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 = "Object is of type 'list', but must be a Django Model, Manager, or QuerySet" + 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") |