Back to index

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

List of all members.

Public Member Functions

def test_constructor
def test_detach
def test_constructor_max_buffer_size_deprecation
def test_constructor_with_not_readable
def test_constructor_with_not_writeable
def test_read
def test_readlines
def test_read1
def test_readinto
def test_write
def test_peek
def test_readable
def test_writeable
def test_seekable
def test_close_and_closed
def test_isatty

Static Public Attributes

 tp = pyio.BufferedRWPair

Detailed Description

Definition at line 1366 of file test_io.py.


Member Function Documentation

Definition at line 1336 of file test_io.py.

01336 
01337     def test_close_and_closed(self):
01338         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01339         self.assertFalse(pair.closed)
01340         pair.close()
01341         self.assertTrue(pair.closed)

Here is the call graph for this function:

Definition at line 1247 of file test_io.py.

01247 
01248     def test_constructor(self):
01249         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01250         self.assertFalse(pair.closed)

Here is the call graph for this function:

Definition at line 1255 of file test_io.py.

01255 
01256     def test_constructor_max_buffer_size_deprecation(self):
01257         with support.check_warnings(("max_buffer_size is deprecated",
01258                                      DeprecationWarning)):
01259             self.tp(self.MockRawIO(), self.MockRawIO(), 8, 12)

Definition at line 1260 of file test_io.py.

01260 
01261     def test_constructor_with_not_readable(self):
01262         class NotReadable(MockRawIO):
01263             def readable(self):
01264                 return False
01265 
01266         self.assertRaises(IOError, self.tp, NotReadable(), self.MockRawIO())

Here is the call graph for this function:

Definition at line 1267 of file test_io.py.

01267 
01268     def test_constructor_with_not_writeable(self):
01269         class NotWriteable(MockRawIO):
01270             def writable(self):
01271                 return False
01272 
01273         self.assertRaises(IOError, self.tp, self.MockRawIO(), NotWriteable())

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_detach (   self) [inherited]

Definition at line 1251 of file test_io.py.

01251 
01252     def test_detach(self):
01253         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01254         self.assertRaises(self.UnsupportedOperation, pair.detach)

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_isatty (   self) [inherited]

Definition at line 1342 of file test_io.py.

01342 
01343     def test_isatty(self):
01344         class SelectableIsAtty(MockRawIO):
01345             def __init__(self, isatty):
01346                 MockRawIO.__init__(self)
01347                 self._isatty = isatty
01348 
01349             def isatty(self):
01350                 return self._isatty
01351 
01352         pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(False))
01353         self.assertFalse(pair.isatty())
01354 
01355         pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(False))
01356         self.assertTrue(pair.isatty())
01357 
01358         pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(True))
01359         self.assertTrue(pair.isatty())
01360 
01361         pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(True))
01362         self.assertTrue(pair.isatty())

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_peek (   self) [inherited]

Definition at line 1313 of file test_io.py.

01313 
01314     def test_peek(self):
01315         pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())
01316 
01317         self.assertTrue(pair.peek(3).startswith(b"abc"))
01318         self.assertEqual(pair.read(3), b"abc")

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_read (   self) [inherited]

Definition at line 1274 of file test_io.py.

01274 
01275     def test_read(self):
01276         pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())
01277 
01278         self.assertEqual(pair.read(3), b"abc")
01279         self.assertEqual(pair.read(1), b"d")
01280         self.assertEqual(pair.read(), b"ef")
01281         pair = self.tp(self.BytesIO(b"abc"), self.MockRawIO())
01282         self.assertEqual(pair.read(None), b"abc")

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_read1 (   self) [inherited]

Definition at line 1289 of file test_io.py.

01289 
01290     def test_read1(self):
01291         # .read1() is delegated to the underlying reader object, so this test
01292         # can be shallow.
01293         pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())
01294 
01295         self.assertEqual(pair.read1(3), b"abc")

Here is the call graph for this function:

Definition at line 1319 of file test_io.py.

01319 
01320     def test_readable(self):
01321         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01322         self.assertTrue(pair.readable())

Here is the call graph for this function:

Definition at line 1296 of file test_io.py.

01296 
01297     def test_readinto(self):
01298         pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())
01299 
01300         data = bytearray(5)
01301         self.assertEqual(pair.readinto(data), 5)
01302         self.assertEqual(data, b"abcde")

Here is the call graph for this function:

Definition at line 1283 of file test_io.py.

01283 
01284     def test_readlines(self):
01285         pair = lambda: self.tp(self.BytesIO(b"abc\ndef\nh"), self.MockRawIO())
01286         self.assertEqual(pair().readlines(), [b"abc\n", b"def\n", b"h"])
01287         self.assertEqual(pair().readlines(), [b"abc\n", b"def\n", b"h"])
01288         self.assertEqual(pair().readlines(5), [b"abc\n", b"def\n"])

Here is the call graph for this function:

Definition at line 1327 of file test_io.py.

01327 
01328     def test_seekable(self):
01329         # BufferedRWPairs are never seekable, even if their readers and writers
01330         # are.
01331         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01332         self.assertFalse(pair.seekable())

Here is the call graph for this function:

def test.test_io.BufferedRWPairTest.test_write (   self) [inherited]

Definition at line 1303 of file test_io.py.

01303 
01304     def test_write(self):
01305         w = self.MockRawIO()
01306         pair = self.tp(self.MockRawIO(), w)
01307 
01308         pair.write(b"abc")
01309         pair.flush()
01310         pair.write(b"def")
01311         pair.flush()
01312         self.assertEqual(w._write_stack, [b"abc", b"def"])

Here is the call graph for this function:

Definition at line 1323 of file test_io.py.

01323 
01324     def test_writeable(self):
01325         pair = self.tp(self.MockRawIO(), self.MockRawIO())
01326         self.assertTrue(pair.writable())

Here is the call graph for this function:


Member Data Documentation

test.test_io.PyBufferedRWPairTest.tp = pyio.BufferedRWPair [static]

Definition at line 1367 of file test_io.py.


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