diff --git a/tests/async/tests.py b/tests/async/tests.py index 43051c369a4b..b7b9dfbe7b16 100644 --- a/tests/async/tests.py +++ b/tests/async/tests.py @@ -118,7 +118,7 @@ def test_options_handler_responds_correctly(self): if is_coroutine: response = asyncio.run(response) - self.assertIsInstance(response, HttpResponse) + self.assertIs(type(response), HttpResponse) def test_http_method_not_allowed_responds_correctly(self): request_factory = RequestFactory() @@ -137,7 +137,7 @@ def test_http_method_not_allowed_responds_correctly(self): if is_coroutine: response = asyncio.run(response) - self.assertIsInstance(response, HttpResponseNotAllowed) + self.assertIs(type(response), HttpResponseNotAllowed) def test_base_view_class_is_sync(self): """ diff --git a/tests/decorators/test_common.py b/tests/decorators/test_common.py index 53ec5c07bcd1..89a2c30cd55d 100644 --- a/tests/decorators/test_common.py +++ b/tests/decorators/test_common.py @@ -26,7 +26,7 @@ def sync_view(request): return HttpResponse() self.assertIs(sync_view.should_append_slash, False) - self.assertIsInstance(sync_view(HttpRequest()), HttpResponse) + self.assertIs(type(sync_view(HttpRequest())), HttpResponse) async def test_no_append_slash_decorator_async_view(self): @no_append_slash @@ -34,4 +34,4 @@ async def async_view(request): return HttpResponse() self.assertIs(async_view.should_append_slash, False) - self.assertIsInstance(await async_view(HttpRequest()), HttpResponse) + self.assertIs(type(await async_view(HttpRequest())), HttpResponse) diff --git a/tests/decorators/test_csrf.py b/tests/decorators/test_csrf.py index eb01339cf950..064b4b9e598f 100644 --- a/tests/decorators/test_csrf.py +++ b/tests/decorators/test_csrf.py @@ -182,7 +182,7 @@ def sync_view(request): return HttpResponse() self.assertIs(sync_view.csrf_exempt, True) - self.assertIsInstance(sync_view(HttpRequest()), HttpResponse) + self.assertIs(type(sync_view(HttpRequest())), HttpResponse) async def test_csrf_exempt_decorator_async_view(self): @csrf_exempt @@ -190,4 +190,4 @@ async def async_view(request): return HttpResponse() self.assertIs(async_view.csrf_exempt, True) - self.assertIsInstance(await async_view(HttpRequest()), HttpResponse) + self.assertIs(type(await async_view(HttpRequest())), HttpResponse) diff --git a/tests/decorators/test_http.py b/tests/decorators/test_http.py index b0bb4c1e00fb..2e6456a7e0fe 100644 --- a/tests/decorators/test_http.py +++ b/tests/decorators/test_http.py @@ -33,15 +33,15 @@ def my_view(request): request = HttpRequest() request.method = "GET" - self.assertIsInstance(my_view(request), HttpResponse) + self.assertIs(type(my_view(request)), HttpResponse) request.method = "PUT" - self.assertIsInstance(my_view(request), HttpResponse) + self.assertIs(type(my_view(request)), HttpResponse) request.method = "HEAD" - self.assertIsInstance(my_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_view(request)), HttpResponseNotAllowed) request.method = "POST" - self.assertIsInstance(my_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_view(request)), HttpResponseNotAllowed) request.method = "DELETE" - self.assertIsInstance(my_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_view(request)), HttpResponseNotAllowed) async def test_require_http_methods_methods_async_view(self): @require_http_methods(["GET", "PUT"]) @@ -50,15 +50,15 @@ async def my_view(request): request = HttpRequest() request.method = "GET" - self.assertIsInstance(await my_view(request), HttpResponse) + self.assertIs(type(await my_view(request)), HttpResponse) request.method = "PUT" - self.assertIsInstance(await my_view(request), HttpResponse) + self.assertIs(type(await my_view(request)), HttpResponse) request.method = "HEAD" - self.assertIsInstance(await my_view(request), HttpResponseNotAllowed) + self.assertIs(type(await my_view(request)), HttpResponseNotAllowed) request.method = "POST" - self.assertIsInstance(await my_view(request), HttpResponseNotAllowed) + self.assertIs(type(await my_view(request)), HttpResponseNotAllowed) request.method = "DELETE" - self.assertIsInstance(await my_view(request), HttpResponseNotAllowed) + self.assertIs(type(await my_view(request)), HttpResponseNotAllowed) class RequireSafeDecoratorTest(SimpleTestCase): @@ -69,15 +69,15 @@ def my_view(request): my_safe_view = require_safe(my_view) request = HttpRequest() request.method = "GET" - self.assertIsInstance(my_safe_view(request), HttpResponse) + self.assertIs(type(my_safe_view(request)), HttpResponse) request.method = "HEAD" - self.assertIsInstance(my_safe_view(request), HttpResponse) + self.assertIs(type(my_safe_view(request)), HttpResponse) request.method = "POST" - self.assertIsInstance(my_safe_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_safe_view(request)), HttpResponseNotAllowed) request.method = "PUT" - self.assertIsInstance(my_safe_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_safe_view(request)), HttpResponseNotAllowed) request.method = "DELETE" - self.assertIsInstance(my_safe_view(request), HttpResponseNotAllowed) + self.assertIs(type(my_safe_view(request)), HttpResponseNotAllowed) async def test_require_safe_accepts_only_safe_methods_async_view(self): @require_safe @@ -86,15 +86,15 @@ async def async_view(request): request = HttpRequest() request.method = "GET" - self.assertIsInstance(await async_view(request), HttpResponse) + self.assertIs(type(await async_view(request)), HttpResponse) request.method = "HEAD" - self.assertIsInstance(await async_view(request), HttpResponse) + self.assertIs(type(await async_view(request)), HttpResponse) request.method = "POST" - self.assertIsInstance(await async_view(request), HttpResponseNotAllowed) + self.assertIs(type(await async_view(request)), HttpResponseNotAllowed) request.method = "PUT" - self.assertIsInstance(await async_view(request), HttpResponseNotAllowed) + self.assertIs(type(await async_view(request)), HttpResponseNotAllowed) request.method = "DELETE" - self.assertIsInstance(await async_view(request), HttpResponseNotAllowed) + self.assertIs(type(await async_view(request)), HttpResponseNotAllowed) class ConditionDecoratorTest(SimpleTestCase):