class InputStreamTestMixin(WSGITestsMixin): (source)
Known subclasses: twisted.web.test.test_wsgi.InputStreamBytesIOTests
, twisted.web.test.test_wsgi.InputStreamTemporaryFileTests
A mixin for TestCase
subclasses which defines a number of tests against _InputStream
. The subclass is expected to create a file-like object to be wrapped by an _InputStream
under test.
Method | get |
Undocumented |
Method | test |
Iterating over _InputStream produces lines from the input stream. |
Method | test_iterable |
Iterating over _InputStream after calling _InputStream.read produces lines from the input stream starting from the first byte after the last byte returned by the read call. |
Method | test_read |
Calling _InputStream.read with no arguments returns the entire input stream. |
Method | test |
Calling _InputStream.readline with no argument returns one line from the input stream. |
Method | test_readline |
Calling _InputStream.readline with an integer which is greater than the number of bytes in the next line returns only the next line. |
Method | test_readline |
Calling _InputStream.readline with a negative integer as an argument returns one line from the input stream. |
Method | test_readline |
Calling _InputStream.readline with None as an argument returns one line from the input stream. |
Method | test |
Calling _InputStream.readlines with no arguments returns a list of all lines from the input stream. |
Method | test_readlines |
Calling _InputStream.readlines after a call to _InputStream.read returns lines starting at the byte after the last byte returned by the read call. |
Method | test_readlines |
Calling _InputStream.readlines with an integer which is greater than the total number of bytes in the input stream returns a list of all lines from the input. |
Method | test_readlines |
Calling _InputStream.readlines with a negative integer as an argument returns a list of all lines from the input. |
Method | test_readlines |
Calling _InputStream.readlines with None as an argument returns all lines from the input. |
Method | test_readline |
Calling _InputStream.readline with an integer returns at most that many bytes, even if it is not enough to make up a complete line. |
Method | test_readlines |
Calling _InputStream.readlines with an integer as an argument returns a list of lines from the input stream with the argument serving as an approximate bound on the total number of bytes to read. |
Method | test_readline |
Calling _InputStream.readline a second time returns the line following the line returned by the first call. |
Method | test_read |
Calling _InputStream.read with an integer that is greater than the total number of bytes in the input stream returns all bytes in the input stream. |
Method | test_read |
Calling _InputStream.read with a negative integer as an argument returns all bytes in the input stream. |
Method | test_read |
Calling _InputStream.read with None as an argument returns all bytes in the input stream. |
Method | test_read |
Calling _InputStream.read with an integer returns that many bytes from the input stream, as long as it is less than or equal to the total number of bytes available. |
Method | test_read |
Calling _InputStream.read a second time returns bytes starting from the position after the last byte returned by the previous read. |
Method | _render |
Undocumented |
Inherited from WSGITestsMixin
:
Method | get |
Undocumented |
Method | low |
No summary |
Method | prepare |
Prepare a Request which, when a request is received, captures the environ and start_response callable passed to a WSGI app. |
Method | render |
Undocumented |
Method | request |
Undocumented |
Method | set |
Undocumented |
Instance Variable | channel |
A no-argument callable which will be invoked to create a new HTTP channel to associate with request objects. |
Instance Variable | reactor |
Undocumented |
Instance Variable | threadpool |
Undocumented |
twisted.web.test.test_wsgi.InputStreamBytesIOTests
, twisted.web.test.test_wsgi.InputStreamTemporaryFileTests
Undocumented
Iterating over _InputStream
after calling _InputStream.read
produces lines from the input stream starting from the first byte after the last byte returned by the read call.
Calling _InputStream.readline
with an integer which is greater than the number of bytes in the next line returns only the next line.
Calling _InputStream.readline
with a negative integer as an argument returns one line from the input stream.
Calling _InputStream.readlines
after a call to _InputStream.read
returns lines starting at the byte after the last byte returned by the read call.
Calling _InputStream.readlines
with an integer which is greater than the total number of bytes in the input stream returns a list of all lines from the input.
Calling _InputStream.readlines
with a negative integer as an argument returns a list of all lines from the input.
Calling _InputStream.readline
with an integer returns at most that many bytes, even if it is not enough to make up a complete line.
COMPATIBILITY NOTE: the size argument is excluded from the WSGI specification, but is provided here anyhow, because useful libraries such as python stdlib's cgi.py assume their input file-like-object supports readline with a size argument. If you use it, be aware your application may not be portable to other conformant WSGI servers.
Calling _InputStream.readlines
with an integer as an argument returns a list of lines from the input stream with the argument serving as an approximate bound on the total number of bytes to read.
Calling _InputStream.readline
a second time returns the line following the line returned by the first call.
Calling _InputStream.read
with an integer that is greater than the total number of bytes in the input stream returns all bytes in the input stream.
Calling _InputStream.read
with a negative integer as an argument returns all bytes in the input stream.
Calling _InputStream.read
with an integer returns that many bytes from the input stream, as long as it is less than or equal to the total number of bytes available.
Calling _InputStream.read
a second time returns bytes starting from the position after the last byte returned by the previous read.