diff options
Diffstat (limited to 'tests/urlpatterns/tests.py')
| -rw-r--r-- | tests/urlpatterns/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/urlpatterns/tests.py b/tests/urlpatterns/tests.py index aa593294af..dca9f63086 100644 --- a/tests/urlpatterns/tests.py +++ b/tests/urlpatterns/tests.py @@ -5,6 +5,7 @@ from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase from django.test.utils import override_settings from django.urls import NoReverseMatch, Resolver404, path, resolve, reverse +from django.views import View from .converters import DynamicConverter from .views import empty_view @@ -146,6 +147,14 @@ class SimplifiedURLTests(SimpleTestCase): with self.assertRaisesMessage(TypeError, msg): path('articles/', 'invalid_view') + def test_invalid_view_instance(self): + class EmptyCBV(View): + pass + + msg = 'view must be a callable, pass EmptyCBV.as_view(), not EmptyCBV().' + with self.assertRaisesMessage(TypeError, msg): + path('foo', EmptyCBV()) + def test_whitespace_in_route(self): msg = ( "URL route 'space/<int:num>/extra/<str:%stest>' cannot contain " |
