Merge branch 'main' of github.com:sanic-org/sanic into guide-improvements

This commit is contained in:
Adam Hopkins 2023-09-10 14:29:09 +03:00
commit 81d986a413
No known key found for this signature in database
GPG Key ID: 9F85EE6C807303FB
2 changed files with 7 additions and 6 deletions

View File

@ -20,6 +20,7 @@ from pytest import LogCaptureFixture
from sanic import Request, Sanic from sanic import Request, Sanic
from sanic.compat import Header from sanic.compat import Header
from sanic.constants import DEFAULT_HTTP_CONTENT_TYPE
from sanic.cookies import CookieJar from sanic.cookies import CookieJar
from sanic.response import ( from sanic.response import (
HTTPResponse, HTTPResponse,
@ -545,7 +546,7 @@ def test_raw_response(app):
return raw(b"raw_response") return raw(b"raw_response")
request, response = app.test_client.get("/test") request, response = app.test_client.get("/test")
assert response.content_type == "application/octet-stream" assert response.content_type == DEFAULT_HTTP_CONTENT_TYPE
assert response.body == b"raw_response" assert response.body == b"raw_response"

View File

@ -502,7 +502,7 @@ def test_dynamic_route_int(app):
request, response = app.test_client.get("/folder/12345") request, response = app.test_client.get("/folder/12345")
assert response.text == "OK" assert response.text == "OK"
assert type(results[0]) is int assert isinstance(results[0], int)
request, response = app.test_client.get("/folder/asdf") request, response = app.test_client.get("/folder/asdf")
assert response.status == 404 assert response.status == 404
@ -518,7 +518,7 @@ def test_dynamic_route_number(app):
request, response = app.test_client.get("/weight/12345") request, response = app.test_client.get("/weight/12345")
assert response.text == "OK" assert response.text == "OK"
assert type(results[0]) is float assert isinstance(results[0], float)
request, response = app.test_client.get("/weight/1234.56") request, response = app.test_client.get("/weight/1234.56")
assert response.status == 200 assert response.status == 200
@ -567,7 +567,7 @@ def test_dynamic_route_uuid(app):
url = "/quirky/123e4567-e89b-12d3-a456-426655440000" url = "/quirky/123e4567-e89b-12d3-a456-426655440000"
request, response = app.test_client.get(url) request, response = app.test_client.get(url)
assert response.text == "OK" assert response.text == "OK"
assert type(results[0]) is uuid.UUID assert isinstance(results[0], uuid.UUID)
generated_uuid = uuid.uuid4() generated_uuid = uuid.uuid4()
request, response = app.test_client.get(f"/quirky/{generated_uuid}") request, response = app.test_client.get(f"/quirky/{generated_uuid}")
@ -861,7 +861,7 @@ def test_dynamic_add_route_int(app):
request, response = app.test_client.get("/folder/12345") request, response = app.test_client.get("/folder/12345")
assert response.text == "OK" assert response.text == "OK"
assert type(results[0]) is int assert isinstance(results[0], int)
request, response = app.test_client.get("/folder/asdf") request, response = app.test_client.get("/folder/asdf")
assert response.status == 404 assert response.status == 404
@ -878,7 +878,7 @@ def test_dynamic_add_route_number(app):
request, response = app.test_client.get("/weight/12345") request, response = app.test_client.get("/weight/12345")
assert response.text == "OK" assert response.text == "OK"
assert type(results[0]) is float assert isinstance(results[0], float)
request, response = app.test_client.get("/weight/1234.56") request, response = app.test_client.get("/weight/1234.56")
assert response.status == 200 assert response.status == 200