Package zope :: Package testing :: Module doctest :: Class _SpoofOut
[show private | hide private]
[frames | no frames]

Class _SpoofOut

StringIO --+
           |
          _SpoofOut


Method Summary
  getvalue(self)
Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called.
  truncate(self, size)
Truncate the file's size.
    Inherited from StringIO
  __init__(self, buf)
  __iter__(self)
  close(self)
Free the memory buffer.
  flush(self)
Flush the internal buffer
  isatty(self)
Returns False because StringIO objects are not connected to a tty-like device.
  next(self)
A file object is its own iterator, for example iter(f) returns f (unless f is closed).
  read(self, n)
Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes).
  readline(self, length)
Read one entire line from the file.
  readlines(self, sizehint)
Read until EOF using readline() and return a list containing the lines thus read.
  seek(self, pos, mode)
Set the file's current position.
  tell(self)
Return the file's current position.
  write(self, s)
Write a string to the file.
  writelines(self, iterable)
Write a sequence of strings to the file.

Method Details

getvalue(self)

Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called.

The StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause a UnicodeError to be raised when getvalue() is called.
Overrides:
StringIO.StringIO.getvalue (inherited documentation)

truncate(self, size=None)

Truncate the file's size.

If the optional size argument is present, the file is truncated to (at most) that size. The size defaults to the current position. The current file position is not changed unless the position is beyond the new file size.

If the specified size exceeds the file's current size, the file remains unchanged.
Overrides:
StringIO.StringIO.truncate (inherited documentation)

Generated by Epydoc 2.1 on Fri Jun 24 12:01:21 2005 http://epydoc.sf.net