Addressed typing warnings from pyright
This commit is contained in:
@@ -19,7 +19,7 @@ class TestResponse:
|
|||||||
#: explicitly sets it on the response object.
|
#: explicitly sets it on the response object.
|
||||||
self.reason = None
|
self.reason = None
|
||||||
#: A dictionary with the response headers.
|
#: A dictionary with the response headers.
|
||||||
self.headers = None
|
self.headers = {}
|
||||||
#: The body of the response, as a bytes object.
|
#: The body of the response, as a bytes object.
|
||||||
self.body = None
|
self.body = None
|
||||||
#: The body of the response, decoded to a UTF-8 string. Set to
|
#: The body of the response, decoded to a UTF-8 string. Set to
|
||||||
@@ -195,7 +195,7 @@ class TestClient:
|
|||||||
('127.0.0.1', 1234))
|
('127.0.0.1', 1234))
|
||||||
res = await self.app.dispatch_request(req)
|
res = await self.app.dispatch_request(req)
|
||||||
if res == Response.already_handled:
|
if res == Response.already_handled:
|
||||||
return None
|
return TestResponse()
|
||||||
res.complete()
|
res.complete()
|
||||||
|
|
||||||
self._update_cookies(res)
|
self._update_cookies(res)
|
||||||
|
|||||||
@@ -771,7 +771,7 @@ class TestMicrodot(unittest.TestCase):
|
|||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
res = self._run(client.get('/'))
|
res = self._run(client.get('/'))
|
||||||
self.assertEqual(res, None)
|
self.assertEqual(res.body, None)
|
||||||
|
|
||||||
def test_mount(self):
|
def test_mount(self):
|
||||||
subapp = Microdot()
|
subapp = Microdot()
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ class TestWebSocket(unittest.TestCase):
|
|||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
res = self._run(client.websocket('/echo', ws))
|
res = self._run(client.websocket('/echo', ws))
|
||||||
self.assertIsNone(res)
|
self.assertIsNone(res.body)
|
||||||
self.assertEqual(results, ['hello', b'bye', b'*' * 300, b'+' * 65537])
|
self.assertEqual(results, ['hello', b'bye', b'*' * 300, b'+' * 65537])
|
||||||
|
|
||||||
res = self._run(client.websocket('/divzero', ws))
|
res = self._run(client.websocket('/divzero', ws))
|
||||||
self.assertIsNone(res)
|
self.assertIsNone(res.body)
|
||||||
WebSocket.max_message_length = -1
|
WebSocket.max_message_length = -1
|
||||||
|
|
||||||
@unittest.skipIf(sys.implementation.name == 'micropython',
|
@unittest.skipIf(sys.implementation.name == 'micropython',
|
||||||
@@ -74,7 +74,7 @@ class TestWebSocket(unittest.TestCase):
|
|||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
res = self._run(client.websocket('/echo', ws))
|
res = self._run(client.websocket('/echo', ws))
|
||||||
self.assertIsNone(res)
|
self.assertIsNone(res.body)
|
||||||
self.assertEqual(results, [])
|
self.assertEqual(results, [])
|
||||||
Request.max_body_length = saved_max_body_length
|
Request.max_body_length = saved_max_body_length
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user