/opt/imh-python/lib/python3.9/site-packages/cheroot/test
NameSizeModeActions
__pycache__/-0755rm
conftest.py27150644editdlrm
helper.py47550644editdlrm
test_cli.py26640644editdlrm
test_conn.py533930644editdlrm
test_core.py146990644editdlrm
test_dispatch.py12100644editdlrm
test_errors.py9240644editdlrm
test_makefile.py11910644editdlrm
test_server.py166970644editdlrm
test_ssl.py222680644editdlrm
test_wsgi.py28230644editdlrm
test__compat.py16610644editdlrm
webtest.py183980644editdlrm
_pytest_plugin.py17680644editdlrm
__init__.py260644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/cheroot/test/test_makefile.py (1191B)
"""Tests for :py:mod:`cheroot.makefile`.""" from cheroot import makefile class MockSocket: """A mock socket.""" def __init__(self): """Initialize :py:class:`MockSocket`.""" self.messages = [] def recv_into(self, buf): """Simulate ``recv_into`` for Python 3.""" if not self.messages: return 0 msg = self.messages.pop(0) for index, byte in enumerate(msg): buf[index] = byte return len(msg) def recv(self, size): """Simulate ``recv`` for Python 2.""" try: return self.messages.pop(0) except IndexError: return '' def send(self, val): """Simulate a send.""" return len(val) def test_bytes_read(): """Reader should capture bytes read.""" sock = MockSocket() sock.messages.append(b'foo') rfile = makefile.MakeFile(sock, 'r') rfile.read() assert rfile.bytes_read == 3 def test_bytes_written(): """Writer should capture bytes written.""" sock = MockSocket() sock.messages.append(b'foo') wfile = makefile.MakeFile(sock, 'w') wfile.write(b'bar') assert wfile.bytes_written == 3