From c231bb32d7fa6c5122c413817e13e49f50d69378 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Wed, 1 May 2019 06:03:30 -0700 Subject: [PATCH] Fix BytesWarning in test_schemas.py When Python is run with the -b command line argument, the following warning was previously emitted: tests/test_schemas.py::test_schema_handles_exception .../django-rest-framework/tests/test_schemas.py:1361: BytesWarning: str() on a bytes instance assert "You do not have permission to perform this action." in str(response.content) To fix this warning decode the bytes with an explicit encoding. For details on the -b command line argument, see: https://docs.python.org/3/using/cmdline.html#cmdoption-b --- tests/test_schemas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 1aad5d1de..230f8f012 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -1358,4 +1358,4 @@ def test_schema_handles_exception(): response = schema_view(request) response.render() assert response.status_code == 403 - assert "You do not have permission to perform this action." in str(response.content) + assert b"You do not have permission to perform this action." in response.content