Back to index

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

List of all members.

Public Member Functions

def test_getstate
def test_setstate
def test_read1
def test_readinto
def test_relative_seek
def test_unicode
def test_bytes_array
def test_issue5449
def test_detach
def write_ops
def test_write
def test_writelines
def test_writelines_error
def test_truncate
def test_init
def test_read
def test_readline
def test_readlines
def test_iterator
def test_getvalue
def test_seek
def test_overseek
def test_tell
def test_flush
def test_flags
def test_subclassing
def test_instance_dict_leak
def test_pickling
def testInit
def testRead
def testReadNoArgs
def testSeek
def testTell
def test_getbuffer

Static Public Member Functions

def buftype

Static Public Attributes

 ioclass = io.BytesIO
 UnsupportedOperation = io.UnsupportedOperation
string EOF = ""

Detailed Description

Definition at line 627 of file test_memoryio.py.


Member Function Documentation

def test.test_memoryio.PyBytesIOTest.buftype (   s) [static, inherited]

Definition at line 416 of file test_memoryio.py.

00416 
00417     def buftype(s):
        return s.encode("ascii")

Here is the caller graph for this function:

Definition at line 484 of file test_memoryio.py.

00484 
00485     def test_bytes_array(self):
00486         buf = b"1234567890"
00487         import array
00488         a = array.array('b', list(buf))
00489         memio = self.ioclass(a)
00490         self.assertEqual(memio.getvalue(), buf)
00491         self.assertEqual(memio.write(a), 10)
00492         self.assertEqual(memio.getvalue(), buf)

Here is the call graph for this function:

Definition at line 60 of file test_memoryio.py.

00060 
00061     def test_detach(self):
00062         buf = self.ioclass()
00063         self.assertRaises(self.UnsupportedOperation, buf.detach)

Here is the call graph for this function:

Definition at line 312 of file test_memoryio.py.

00312 
00313     def test_flags(self):
00314         memio = self.ioclass()
00315 
00316         self.assertEqual(memio.writable(), True)
00317         self.assertEqual(memio.readable(), True)
00318         self.assertEqual(memio.seekable(), True)
00319         self.assertEqual(memio.isatty(), False)
00320         self.assertEqual(memio.closed, False)
00321         memio.close()
00322         self.assertEqual(memio.writable(), True)
00323         self.assertEqual(memio.readable(), True)
00324         self.assertEqual(memio.seekable(), True)
00325         self.assertRaises(ValueError, memio.isatty)
00326         self.assertEqual(memio.closed, True)

Here is the call graph for this function:

Definition at line 306 of file test_memoryio.py.

00306 
00307     def test_flush(self):
00308         buf = self.buftype("1234567890")
00309         memio = self.ioclass(buf)
00310 
00311         self.assertEqual(memio.flush(), None)

Here is the call graph for this function:

Definition at line 389 of file test_memoryio.py.

00389 
00390     def test_getbuffer(self):
00391         memio = self.ioclass(b"1234567890")
00392         buf = memio.getbuffer()
00393         self.assertEqual(bytes(buf), b"1234567890")
00394         memio.seek(5)
00395         buf = memio.getbuffer()
00396         self.assertEqual(bytes(buf), b"1234567890")
00397         # Trying to change the size of the BytesIO while a buffer is exported
00398         # raises a BufferError.
00399         self.assertRaises(BufferError, memio.write, b'x' * 100)
00400         self.assertRaises(BufferError, memio.truncate)
00401         # Mutating the buffer updates the BytesIO
00402         buf[3:6] = b"abc"
00403         self.assertEqual(bytes(buf), b"123abc7890")
00404         self.assertEqual(memio.getvalue(), b"123abc7890")
00405         # After the buffer gets released, we can resize the BytesIO again
00406         del buf
00407         support.gc_collect()
00408         memio.truncate()
00409 

Here is the call graph for this function:

Definition at line 631 of file test_memoryio.py.

00631 
00632     def test_getstate(self):
00633         memio = self.ioclass()
00634         state = memio.__getstate__()
00635         self.assertEqual(len(state), 3)
00636         bytearray(state[0]) # Check if state[0] supports the buffer interface.
00637         self.assertIsInstance(state[1], int)
00638         self.assertTrue(isinstance(state[2], dict) or state[2] is None)
00639         memio.close()
00640         self.assertRaises(ValueError, memio.__getstate__)

Here is the call graph for this function:

Definition at line 244 of file test_memoryio.py.

00244 
00245     def test_getvalue(self):
00246         buf = self.buftype("1234567890")
00247         memio = self.ioclass(buf)
00248 
00249         self.assertEqual(memio.getvalue(), buf)
00250         memio.read()
00251         self.assertEqual(memio.getvalue(), buf)
00252         self.assertEqual(type(memio.getvalue()), type(buf))
00253         memio = self.ioclass(buf * 1000)
00254         self.assertEqual(memio.getvalue()[-3:], self.buftype("890"))
00255         memio = self.ioclass(buf)
00256         memio.close()
00257         self.assertRaises(ValueError, memio.getvalue)

Here is the call graph for this function:

Definition at line 134 of file test_memoryio.py.

00134 
00135     def test_init(self):
00136         buf = self.buftype("1234567890")
00137         memio = self.ioclass(buf)
00138         self.assertEqual(memio.getvalue(), buf)
00139         memio = self.ioclass(None)
00140         self.assertEqual(memio.getvalue(), self.EOF)
00141         memio.__init__(buf * 2)
00142         self.assertEqual(memio.getvalue(), buf * 2)
00143         memio.__init__(buf)
00144         self.assertEqual(memio.getvalue(), buf)
00145         self.assertRaises(TypeError, memio.__init__, [])

Here is the call graph for this function:

Definition at line 343 of file test_memoryio.py.

00343 
00344     def test_instance_dict_leak(self):
00345         # Test case for issue #6242.
00346         # This will be caught by regrtest.py -R if this leak.
00347         for _ in range(100):
00348             memio = self.ioclass()
00349             memio.foo = 1

Definition at line 493 of file test_memoryio.py.

00493 
00494     def test_issue5449(self):
00495         buf = self.buftype("1234567890")
00496         self.ioclass(initial_bytes=buf)
00497         self.assertRaises(TypeError, self.ioclass, buf, foo=None)
00498 

Here is the call graph for this function:

Definition at line 222 of file test_memoryio.py.

00222 
00223     def test_iterator(self):
00224         buf = self.buftype("1234567890\n")
00225         memio = self.ioclass(buf * 10)
00226 
00227         self.assertEqual(iter(memio), memio)
00228         self.assertTrue(hasattr(memio, '__iter__'))
00229         self.assertTrue(hasattr(memio, '__next__'))
00230         i = 0
00231         for line in memio:
00232             self.assertEqual(line, buf)
00233             i += 1
00234         self.assertEqual(i, 10)
00235         memio.seek(0)
00236         i = 0
00237         for line in memio:
00238             self.assertEqual(line, buf)
00239             i += 1
00240         self.assertEqual(i, 10)
00241         memio = self.ioclass(buf * 2)
00242         memio.close()
00243         self.assertRaises(ValueError, memio.__next__)

Here is the call graph for this function:

Definition at line 281 of file test_memoryio.py.

00281 
00282     def test_overseek(self):
00283         buf = self.buftype("1234567890")
00284         memio = self.ioclass(buf)
00285 
00286         self.assertEqual(memio.seek(len(buf) + 1), 11)
00287         self.assertEqual(memio.read(), self.EOF)
00288         self.assertEqual(memio.tell(), 11)
00289         self.assertEqual(memio.getvalue(), buf)
00290         memio.write(self.EOF)
00291         self.assertEqual(memio.getvalue(), buf)
00292         memio.write(buf)
00293         self.assertEqual(memio.getvalue(), buf + self.buftype('\0') + buf)

Here is the call graph for this function:

Definition at line 350 of file test_memoryio.py.

00350 
00351     def test_pickling(self):
00352         buf = self.buftype("1234567890")
00353         memio = self.ioclass(buf)
00354         memio.foo = 42
00355         memio.seek(2)
00356 
00357         class PickleTestMemIO(self.ioclass):
00358             def __init__(me, initvalue, foo):
00359                 self.ioclass.__init__(me, initvalue)
00360                 me.foo = foo
00361             # __getnewargs__ is undefined on purpose. This checks that PEP 307
00362             # is used to provide pickling support.
00363 
00364         # Pickle expects the class to be on the module level. Here we use a
00365         # little hack to allow the PickleTestMemIO class to derive from
00366         # self.ioclass without having to define all combinations explictly on
00367         # the module-level.
00368         import __main__
00369         PickleTestMemIO.__module__ = '__main__'
00370         __main__.PickleTestMemIO = PickleTestMemIO
00371         submemio = PickleTestMemIO(buf, 80)
00372         submemio.seek(2)
00373 
00374         # We only support pickle protocol 2 and onward since we use extended
00375         # __reduce__ API of PEP 307 to provide pickling support.
00376         for proto in range(2, pickle.HIGHEST_PROTOCOL):
00377             for obj in (memio, submemio):
00378                 obj2 = pickle.loads(pickle.dumps(obj, protocol=proto))
00379                 self.assertEqual(obj.getvalue(), obj2.getvalue())
00380                 self.assertEqual(obj.__class__, obj2.__class__)
00381                 self.assertEqual(obj.foo, obj2.foo)
00382                 self.assertEqual(obj.tell(), obj2.tell())
00383                 obj.close()
00384                 self.assertRaises(ValueError, pickle.dumps, obj, proto)
00385         del __main__.PickleTestMemIO
00386 

Here is the call graph for this function:

Definition at line 146 of file test_memoryio.py.

00146 
00147     def test_read(self):
00148         buf = self.buftype("1234567890")
00149         memio = self.ioclass(buf)
00150 
00151         self.assertEqual(memio.read(0), self.EOF)
00152         self.assertEqual(memio.read(1), buf[:1])
00153         self.assertEqual(memio.read(4), buf[1:5])
00154         self.assertEqual(memio.read(900), buf[5:])
00155         self.assertEqual(memio.read(), self.EOF)
00156         memio.seek(0)
00157         self.assertEqual(memio.read(), buf)
00158         self.assertEqual(memio.read(), self.EOF)
00159         self.assertEqual(memio.tell(), 10)
00160         memio.seek(0)
00161         self.assertEqual(memio.read(-1), buf)
00162         memio.seek(0)
00163         self.assertEqual(type(memio.read()), type(buf))
00164         memio.seek(100)
00165         self.assertEqual(type(memio.read()), type(buf))
00166         memio.seek(0)
00167         self.assertEqual(memio.read(None), buf)
00168         self.assertRaises(TypeError, memio.read, '')
00169         memio.close()
00170         self.assertRaises(ValueError, memio.read)

Here is the call graph for this function:

def test.test_memoryio.PyBytesIOTest.test_read1 (   self) [inherited]

Definition at line 421 of file test_memoryio.py.

00421 
00422     def test_read1(self):
00423         buf = self.buftype("1234567890")
00424         memio = self.ioclass(buf)
00425 
00426         self.assertRaises(TypeError, memio.read1)
00427         self.assertEqual(memio.read(), buf)

Here is the call graph for this function:

Definition at line 428 of file test_memoryio.py.

00428 
00429     def test_readinto(self):
00430         buf = self.buftype("1234567890")
00431         memio = self.ioclass(buf)
00432 
00433         b = bytearray(b"hello")
00434         self.assertEqual(memio.readinto(b), 5)
00435         self.assertEqual(b, b"12345")
00436         self.assertEqual(memio.readinto(b), 5)
00437         self.assertEqual(b, b"67890")
00438         self.assertEqual(memio.readinto(b), 0)
00439         self.assertEqual(b, b"67890")
00440         b = bytearray(b"hello world")
00441         memio.seek(0)
00442         self.assertEqual(memio.readinto(b), 10)
00443         self.assertEqual(b, b"1234567890d")
00444         b = bytearray(b"")
00445         memio.seek(0)
00446         self.assertEqual(memio.readinto(b), 0)
00447         self.assertEqual(b, b"")
00448         self.assertRaises(TypeError, memio.readinto, '')
00449         import array
00450         a = array.array('b', b"hello world")
00451         memio = self.ioclass(buf)
00452         memio.readinto(a)
00453         self.assertEqual(a.tobytes(), b"1234567890d")
00454         memio.close()
00455         self.assertRaises(ValueError, memio.readinto, b)
00456         memio = self.ioclass(b"123")
00457         b = bytearray()
00458         memio.seek(42)
00459         memio.readinto(b)
00460         self.assertEqual(b, b"")

Here is the call graph for this function:

Definition at line 171 of file test_memoryio.py.

00171 
00172     def test_readline(self):
00173         buf = self.buftype("1234567890\n")
00174         memio = self.ioclass(buf * 2)
00175 
00176         self.assertEqual(memio.readline(0), self.EOF)
00177         self.assertEqual(memio.readline(), buf)
00178         self.assertEqual(memio.readline(), buf)
00179         self.assertEqual(memio.readline(), self.EOF)
00180         memio.seek(0)
00181         self.assertEqual(memio.readline(5), buf[:5])
00182         self.assertEqual(memio.readline(5), buf[5:10])
00183         self.assertEqual(memio.readline(5), buf[10:15])
00184         memio.seek(0)
00185         self.assertEqual(memio.readline(-1), buf)
00186         memio.seek(0)
00187         self.assertEqual(memio.readline(0), self.EOF)
00188 
00189         buf = self.buftype("1234567890\n")
00190         memio = self.ioclass((buf * 3)[:-1])
00191         self.assertEqual(memio.readline(), buf)
00192         self.assertEqual(memio.readline(), buf)
00193         self.assertEqual(memio.readline(), buf[:-1])
00194         self.assertEqual(memio.readline(), self.EOF)
00195         memio.seek(0)
00196         self.assertEqual(type(memio.readline()), type(buf))
00197         self.assertEqual(memio.readline(), buf)
00198         self.assertRaises(TypeError, memio.readline, '')
00199         memio.close()
00200         self.assertRaises(ValueError,  memio.readline)

Here is the call graph for this function:

Definition at line 201 of file test_memoryio.py.

00201 
00202     def test_readlines(self):
00203         buf = self.buftype("1234567890\n")
00204         memio = self.ioclass(buf * 10)
00205 
00206         self.assertEqual(memio.readlines(), [buf] * 10)
00207         memio.seek(5)
00208         self.assertEqual(memio.readlines(), [buf[5:]] + [buf] * 9)
00209         memio.seek(0)
00210         self.assertEqual(memio.readlines(15), [buf] * 2)
00211         memio.seek(0)
00212         self.assertEqual(memio.readlines(-1), [buf] * 10)
00213         memio.seek(0)
00214         self.assertEqual(memio.readlines(0), [buf] * 10)
00215         memio.seek(0)
00216         self.assertEqual(type(memio.readlines()[0]), type(buf))
00217         memio.seek(0)
00218         self.assertEqual(memio.readlines(None), [buf] * 10)
00219         self.assertRaises(TypeError, memio.readlines, '')
00220         memio.close()
00221         self.assertRaises(ValueError, memio.readlines)

Here is the call graph for this function:

Definition at line 461 of file test_memoryio.py.

00461 
00462     def test_relative_seek(self):
00463         buf = self.buftype("1234567890")
00464         memio = self.ioclass(buf)
00465 
00466         self.assertEqual(memio.seek(-1, 1), 0)
00467         self.assertEqual(memio.seek(3, 1), 3)
00468         self.assertEqual(memio.seek(-4, 1), 0)
00469         self.assertEqual(memio.seek(-1, 2), 9)
00470         self.assertEqual(memio.seek(1, 1), 10)
00471         self.assertEqual(memio.seek(1, 2), 11)
00472         memio.seek(-3, 2)
00473         self.assertEqual(memio.read(), buf[-3:])
00474         memio.seek(0)
00475         memio.seek(1, 1)
00476         self.assertEqual(memio.read(), buf[1:])

Here is the call graph for this function:

Definition at line 258 of file test_memoryio.py.

00258 
00259     def test_seek(self):
00260         buf = self.buftype("1234567890")
00261         memio = self.ioclass(buf)
00262 
00263         memio.read(5)
00264         self.assertRaises(ValueError, memio.seek, -1)
00265         self.assertRaises(ValueError, memio.seek, 1, -1)
00266         self.assertRaises(ValueError, memio.seek, 1, 3)
00267         self.assertEqual(memio.seek(0), 0)
00268         self.assertEqual(memio.seek(0, 0), 0)
00269         self.assertEqual(memio.read(), buf)
00270         self.assertEqual(memio.seek(3), 3)
00271         self.assertEqual(memio.seek(0, 1), 3)
00272         self.assertEqual(memio.read(), buf[3:])
00273         self.assertEqual(memio.seek(len(buf)), len(buf))
00274         self.assertEqual(memio.read(), self.EOF)
00275         memio.seek(len(buf) + 1)
00276         self.assertEqual(memio.read(), self.EOF)
00277         self.assertEqual(memio.seek(0, 2), len(buf))
00278         self.assertEqual(memio.read(), self.EOF)
00279         memio.close()
00280         self.assertRaises(ValueError, memio.seek, 0)

Here is the call graph for this function:

Definition at line 641 of file test_memoryio.py.

00641 
00642     def test_setstate(self):
00643         # This checks whether __setstate__ does proper input validation.
00644         memio = self.ioclass()
00645         memio.__setstate__((b"no error", 0, None))
00646         memio.__setstate__((bytearray(b"no error"), 0, None))
00647         memio.__setstate__((b"no error", 0, {'spam': 3}))
00648         self.assertRaises(ValueError, memio.__setstate__, (b"", -1, None))
00649         self.assertRaises(TypeError, memio.__setstate__, ("unicode", 0, None))
00650         self.assertRaises(TypeError, memio.__setstate__, (b"", 0.0, None))
00651         self.assertRaises(TypeError, memio.__setstate__, (b"", 0, 0))
00652         self.assertRaises(TypeError, memio.__setstate__, (b"len-test", 0))
00653         self.assertRaises(TypeError, memio.__setstate__)
00654         self.assertRaises(TypeError, memio.__setstate__, 0)
00655         memio.close()
00656         self.assertRaises(ValueError, memio.__setstate__, (b"closed", 0, None))
00657 

Here is the call graph for this function:

Definition at line 327 of file test_memoryio.py.

00327 
00328     def test_subclassing(self):
00329         buf = self.buftype("1234567890")
00330         def test1():
00331             class MemIO(self.ioclass):
00332                 pass
00333             m = MemIO(buf)
00334             return m.getvalue()
00335         def test2():
00336             class MemIO(self.ioclass):
00337                 def __init__(me, a, b):
00338                     self.ioclass.__init__(me, a)
00339             m = MemIO(buf, None)
00340             return m.getvalue()
00341         self.assertEqual(test1(), buf)
00342         self.assertEqual(test2(), buf)

Here is the call graph for this function:

Definition at line 294 of file test_memoryio.py.

00294 
00295     def test_tell(self):
00296         buf = self.buftype("1234567890")
00297         memio = self.ioclass(buf)
00298 
00299         self.assertEqual(memio.tell(), 0)
00300         memio.seek(5)
00301         self.assertEqual(memio.tell(), 5)
00302         memio.seek(10000)
00303         self.assertEqual(memio.tell(), 10000)
00304         memio.close()
00305         self.assertRaises(ValueError, memio.tell)

Here is the call graph for this function:

Definition at line 113 of file test_memoryio.py.

00113 
00114     def test_truncate(self):
00115         buf = self.buftype("1234567890")
00116         memio = self.ioclass(buf)
00117 
00118         self.assertRaises(ValueError, memio.truncate, -1)
00119         memio.seek(6)
00120         self.assertEqual(memio.truncate(), 6)
00121         self.assertEqual(memio.getvalue(), buf[:6])
00122         self.assertEqual(memio.truncate(4), 4)
00123         self.assertEqual(memio.getvalue(), buf[:4])
00124         self.assertEqual(memio.tell(), 6)
00125         memio.seek(0, 2)
00126         memio.write(buf)
00127         self.assertEqual(memio.getvalue(), buf[:4] + buf)
00128         pos = memio.tell()
00129         self.assertEqual(memio.truncate(None), pos)
00130         self.assertEqual(memio.tell(), pos)
00131         self.assertRaises(TypeError, memio.truncate, '0')
00132         memio.close()
00133         self.assertRaises(ValueError, memio.truncate, 0)

Here is the call graph for this function:

Definition at line 477 of file test_memoryio.py.

00477 
00478     def test_unicode(self):
00479         memio = self.ioclass()
00480 
00481         self.assertRaises(TypeError, self.ioclass, "1234567890")
00482         self.assertRaises(TypeError, memio.write, "1234567890")
00483         self.assertRaises(TypeError, memio.writelines, ["1234567890"])

Here is the call graph for this function:

Definition at line 77 of file test_memoryio.py.

00077 
00078     def test_write(self):
00079         buf = self.buftype("hello world\n")
00080         memio = self.ioclass(buf)
00081 
00082         self.write_ops(memio, self.buftype)
00083         self.assertEqual(memio.getvalue(), buf)
00084         memio = self.ioclass()
00085         self.write_ops(memio, self.buftype)
00086         self.assertEqual(memio.getvalue(), buf)
00087         self.assertRaises(TypeError, memio.write, None)
00088         memio.close()
00089         self.assertRaises(ValueError, memio.write, self.buftype(""))

Here is the call graph for this function:

Definition at line 90 of file test_memoryio.py.

00090 
00091     def test_writelines(self):
00092         buf = self.buftype("1234567890")
00093         memio = self.ioclass()
00094 
00095         self.assertEqual(memio.writelines([buf] * 100), None)
00096         self.assertEqual(memio.getvalue(), buf * 100)
00097         memio.writelines([])
00098         self.assertEqual(memio.getvalue(), buf * 100)
00099         memio = self.ioclass()
00100         self.assertRaises(TypeError, memio.writelines, [buf] + [1])
00101         self.assertEqual(memio.getvalue(), buf)
00102         self.assertRaises(TypeError, memio.writelines, None)
00103         memio.close()
00104         self.assertRaises(ValueError, memio.writelines, [])

Here is the call graph for this function:

Definition at line 105 of file test_memoryio.py.

00105 
00106     def test_writelines_error(self):
00107         memio = self.ioclass()
00108         def error_gen():
00109             yield self.buftype('spam')
00110             raise KeyboardInterrupt
00111 
00112         self.assertRaises(KeyboardInterrupt, memio.writelines, error_gen())

Here is the call graph for this function:

Definition at line 15 of file test_memoryio.py.

00015 
00016     def testInit(self):
00017         buf = self.buftype("1234567890")
00018         bytesIo = self.ioclass(buf)

Here is the call graph for this function:

Definition at line 19 of file test_memoryio.py.

00019 
00020     def testRead(self):
00021         buf = self.buftype("1234567890")
00022         bytesIo = self.ioclass(buf)
00023 
00024         self.assertEqual(buf[:1], bytesIo.read(1))
00025         self.assertEqual(buf[1:5], bytesIo.read(4))
00026         self.assertEqual(buf[5:], bytesIo.read(900))
00027         self.assertEqual(self.EOF, bytesIo.read())

Here is the call graph for this function:

Definition at line 28 of file test_memoryio.py.

00028 
00029     def testReadNoArgs(self):
00030         buf = self.buftype("1234567890")
00031         bytesIo = self.ioclass(buf)
00032 
00033         self.assertEqual(buf, bytesIo.read())
00034         self.assertEqual(self.EOF, bytesIo.read())

Here is the call graph for this function:

Definition at line 35 of file test_memoryio.py.

00035 
00036     def testSeek(self):
00037         buf = self.buftype("1234567890")
00038         bytesIo = self.ioclass(buf)
00039 
00040         bytesIo.read(5)
00041         bytesIo.seek(0)
00042         self.assertEqual(buf, bytesIo.read())
00043 
00044         bytesIo.seek(3)
00045         self.assertEqual(buf[3:], bytesIo.read())
00046         self.assertRaises(TypeError, bytesIo.seek, 0.0)

Here is the call graph for this function:

Definition at line 47 of file test_memoryio.py.

00047 
00048     def testTell(self):
00049         buf = self.buftype("1234567890")
00050         bytesIo = self.ioclass(buf)
00051 
00052         self.assertEqual(0, bytesIo.tell())
00053         bytesIo.seek(5)
00054         self.assertEqual(5, bytesIo.tell())
00055         bytesIo.seek(10000)
00056         self.assertEqual(10000, bytesIo.tell())
00057 

Here is the call graph for this function:

def test.test_memoryio.MemoryTestMixin.write_ops (   self,
  f,
  t 
) [inherited]

Definition at line 64 of file test_memoryio.py.

00064 
00065     def write_ops(self, f, t):
00066         self.assertEqual(f.write(t("blah.")), 5)
00067         self.assertEqual(f.seek(0), 0)
00068         self.assertEqual(f.write(t("Hello.")), 6)
00069         self.assertEqual(f.tell(), 6)
00070         self.assertEqual(f.seek(5), 5)
00071         self.assertEqual(f.tell(), 5)
00072         self.assertEqual(f.write(t(" world\n\n\n")), 9)
00073         self.assertEqual(f.seek(0), 0)
00074         self.assertEqual(f.write(t("h")), 1)
00075         self.assertEqual(f.truncate(12), 12)
00076         self.assertEqual(f.tell(), 1)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

string test.test_memoryio.PyBytesIOTest.EOF = "" [static, inherited]

Definition at line 419 of file test_memoryio.py.

Reimplemented from test.test_memoryio.PyBytesIOTest.

Definition at line 628 of file test_memoryio.py.

test.test_memoryio.CBytesIOTest.UnsupportedOperation = io.UnsupportedOperation [static]

Reimplemented from test.test_memoryio.PyBytesIOTest.

Definition at line 629 of file test_memoryio.py.


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