Back to index

python3.2  3.2.2
Public Member Functions
test.test_io.PyMockRawIO Class Reference
Inheritance diagram for test.test_io.PyMockRawIO:
Inheritance graph
[legend]
Collaboration diagram for test.test_io.PyMockRawIO:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def read
def write
def writable
def fileno
def readable
def seekable
def seek
def tell
def readinto
def truncate

Detailed Description

Definition at line 129 of file test_io.py.


Member Function Documentation

def test.test_io.MockRawIOWithoutRead.fileno (   self) [inherited]

Definition at line 70 of file test_io.py.

00070 
00071     def fileno(self):
00072         return 42

Here is the caller graph for this function:

def test.test_io.MockRawIO.read (   self,
  n = None 
) [inherited]

Reimplemented in test.test_io.MisbehavedRawIO.

Definition at line 118 of file test_io.py.

00118 
00119     def read(self, n=None):
00120         self._reads += 1
00121         try:
00122             return self._read_stack.pop(0)
00123         except:
00124             self._extraneous_reads += 1
00125             return b""

Here is the caller graph for this function:

def test.test_io.MockRawIOWithoutRead.readable (   self) [inherited]

Definition at line 73 of file test_io.py.

00073 
00074     def readable(self):
00075         return True

def test.test_io.MockRawIOWithoutRead.readinto (   self,
  buf 
) [inherited]

Reimplemented in test.test_io.MisbehavedRawIO.

Definition at line 85 of file test_io.py.

00085 
00086     def readinto(self, buf):
00087         self._reads += 1
00088         max_len = len(buf)
00089         try:
00090             data = self._read_stack[0]
00091         except IndexError:
00092             self._extraneous_reads += 1
00093             return 0
00094         if data is None:
00095             del self._read_stack[0]
00096             return None
00097         n = len(data)
00098         if len(data) <= max_len:
00099             del self._read_stack[0]
00100             buf[:n] = data
00101             return n
00102         else:
00103             buf[:] = data[:max_len]
00104             self._read_stack[0] = data[max_len:]
00105             return max_len

def test.test_io.MockRawIOWithoutRead.seek (   self,
  pos,
  whence 
) [inherited]

Reimplemented in test.test_io.MisbehavedRawIO.

Definition at line 79 of file test_io.py.

00079 
00080     def seek(self, pos, whence):
00081         return 0   # wrong but we gotta return something

Here is the caller graph for this function:

def test.test_io.MockRawIOWithoutRead.seekable (   self) [inherited]

Definition at line 76 of file test_io.py.

00076 
00077     def seekable(self):
00078         return True

def test.test_io.MockRawIOWithoutRead.tell (   self) [inherited]

Reimplemented in test.test_io.MisbehavedRawIO.

Definition at line 82 of file test_io.py.

00082 
00083     def tell(self):
00084         return 0   # same comment as above

def test.test_io.MockRawIOWithoutRead.truncate (   self,
  pos = None 
) [inherited]

Definition at line 106 of file test_io.py.

00106 
00107     def truncate(self, pos=None):
00108         return pos

def test.test_io.MockRawIOWithoutRead.writable (   self) [inherited]

Definition at line 67 of file test_io.py.

00067 
00068     def writable(self):
00069         return True

def test.test_io.MockRawIOWithoutRead.write (   self,
  b 
) [inherited]

Reimplemented in test.test_io.MisbehavedRawIO.

Definition at line 63 of file test_io.py.

00063 
00064     def write(self, b):
00065         self._write_stack.append(bytes(b))
00066         return len(b)


The documentation for this class was generated from the following file: