This commit is contained in:
HawkOwl 2015-08-14 16:44:10 +08:00
parent 2320d73f2a
commit 8e6ca3fb1e
2 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,8 @@ from __future__ import absolute_import
import logging
# A logging handler for Trollius that prints everything out
class PrintHandler(logging.Handler):
def emit(self, record):
print(record)

View File

@ -102,11 +102,11 @@ class WebSocketProtocolTests(unittest.TestCase):
"""
sendClose with a too-long reason will truncate it.
"""
self.protocol.sendClose(code=1000, reason="abc"*1000)
self.protocol.sendClose(code=1000, reason="abc" * 1000)
# We closed properly
self.assertEqual(self.transport._written[2:],
b"\x03\xe8" + (b"abc"*40) + b"...")
b"\x03\xe8" + (b"abc" * 40) + b"...")
self.assertEqual(self.protocol.state, self.protocol.STATE_CLOSING)
def test_sendClose_reason_with_no_code(self):