Back to index

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

List of all members.

Public Member Functions

def test_widechar
def test_getstate
def test_setstate
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_newlines_property
def test_relative_seek
def test_textio_properties
def test_newline_none
def test_newline_empty
def test_newline_lf
def test_newline_cr
def test_newline_crlf
def test_issue5265
def test_newline_argument

Static Public Attributes

 ioclass = io.StringIO
 UnsupportedOperation = io.UnsupportedOperation
 buftype = str
string EOF = ""

Detailed Description

Definition at line 658 of file test_memoryio.py.


Member Function Documentation

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 676 of file test_memoryio.py.

00676 
00677     def test_getstate(self):
00678         memio = self.ioclass()
00679         state = memio.__getstate__()
00680         self.assertEqual(len(state), 4)
00681         self.assertIsInstance(state[0], str)
00682         self.assertIsInstance(state[1], str)
00683         self.assertIsInstance(state[2], int)
00684         self.assertTrue(isinstance(state[3], dict) or state[3] is None)
00685         memio.close()
00686         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 592 of file test_memoryio.py.

00592 
00593     def test_issue5265(self):
00594         # StringIO can duplicate newlines in universal newlines mode
00595         memio = self.ioclass("a\r\nb\r\n", newline=None)
00596         self.assertEqual(memio.read(5), "a\nb\n")

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 597 of file test_memoryio.py.

00597 
00598     def test_newline_argument(self):
00599         self.assertRaises(TypeError, self.ioclass, newline=b"\n")
00600         self.assertRaises(ValueError, self.ioclass, newline="error")
00601         # These should not raise an error
00602         for newline in (None, "", "\n", "\r", "\r\n"):
00603             self.ioclass(newline=newline)
00604 

Here is the call graph for this function:

Definition at line 578 of file test_memoryio.py.

00578 
00579     def test_newline_cr(self):
00580         # newline="\r"
00581         memio = self.ioclass("a\nb\r\nc\rd", newline="\r")
00582         self.assertEqual(memio.read(), "a\rb\r\rc\rd")
00583         memio.seek(0)
00584         self.assertEqual(list(memio), ["a\r", "b\r", "\r", "c\r", "d"])

Here is the call graph for this function:

Definition at line 585 of file test_memoryio.py.

00585 
00586     def test_newline_crlf(self):
00587         # newline="\r\n"
00588         memio = self.ioclass("a\nb\r\nc\rd", newline="\r\n")
00589         self.assertEqual(memio.read(), "a\r\nb\r\r\nc\rd")
00590         memio.seek(0)
00591         self.assertEqual(list(memio), ["a\r\n", "b\r\r\n", "c\rd"])

Here is the call graph for this function:

Definition at line 557 of file test_memoryio.py.

00557 
00558     def test_newline_empty(self):
00559         # newline=""
00560         memio = self.ioclass("a\nb\r\nc\rd", newline="")
00561         self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"])
00562         memio.seek(0)
00563         self.assertEqual(memio.read(4), "a\nb\r")
00564         self.assertEqual(memio.read(2), "\nc")
00565         self.assertEqual(memio.read(1), "\r")
00566         memio = self.ioclass(newline="")
00567         self.assertEqual(2, memio.write("a\n"))
00568         self.assertEqual(2, memio.write("b\r"))
00569         self.assertEqual(2, memio.write("\nc"))
00570         self.assertEqual(2, memio.write("\rd"))
00571         memio.seek(0)
00572         self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"])

Here is the call graph for this function:

Definition at line 573 of file test_memoryio.py.

00573 
00574     def test_newline_lf(self):
00575         # newline="\n"
00576         memio = self.ioclass("a\nb\r\nc\rd")
00577         self.assertEqual(list(memio), ["a\n", "b\r\n", "c\rd"])

Here is the call graph for this function:

Definition at line 539 of file test_memoryio.py.

00539 
00540     def test_newline_none(self):
00541         # newline=None
00542         memio = self.ioclass("a\nb\r\nc\rd", newline=None)
00543         self.assertEqual(list(memio), ["a\n", "b\n", "c\n", "d"])
00544         memio.seek(0)
00545         self.assertEqual(memio.read(1), "a")
00546         self.assertEqual(memio.read(2), "\nb")
00547         self.assertEqual(memio.read(2), "\nc")
00548         self.assertEqual(memio.read(1), "\n")
00549         memio = self.ioclass(newline=None)
00550         self.assertEqual(2, memio.write("a\n"))
00551         self.assertEqual(3, memio.write("b\r\n"))
00552         self.assertEqual(3, memio.write("c\rd"))
00553         memio.seek(0)
00554         self.assertEqual(memio.read(), "a\nb\nc\nd")
00555         memio = self.ioclass("a\r\nb", newline=None)
00556         self.assertEqual(memio.read(3), "a\nb")

Here is the call graph for this function:

Definition at line 501 of file test_memoryio.py.

00501 
00502     def test_newlines_property(self):
00503         memio = self.ioclass(newline=None)
00504         # The C StringIO decodes newlines in write() calls, but the Python
00505         # implementation only does when reading.  This function forces them to
00506         # be decoded for testing.
00507         def force_decode():
00508             memio.seek(0)
00509             memio.read()
00510         self.assertEqual(memio.newlines, None)
00511         memio.write("a\n")
00512         force_decode()
00513         self.assertEqual(memio.newlines, "\n")
00514         memio.write("b\r\n")
00515         force_decode()
00516         self.assertEqual(memio.newlines, ("\n", "\r\n"))
00517         memio.write("c\rd")
00518         force_decode()
00519         self.assertEqual(memio.newlines, ("\r", "\n", "\r\n"))

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:

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 520 of file test_memoryio.py.

00520 
00521     def test_relative_seek(self):
00522         memio = self.ioclass()
00523 
00524         self.assertRaises(IOError, memio.seek, -1, 1)
00525         self.assertRaises(IOError, memio.seek, 3, 1)
00526         self.assertRaises(IOError, memio.seek, -3, 1)
00527         self.assertRaises(IOError, memio.seek, -1, 2)
00528         self.assertRaises(IOError, memio.seek, 1, 1)
00529         self.assertRaises(IOError, memio.seek, 1, 2)

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 687 of file test_memoryio.py.

00687 
00688     def test_setstate(self):
00689         # This checks whether __setstate__ does proper input validation.
00690         memio = self.ioclass()
00691         memio.__setstate__(("no error", "\n", 0, None))
00692         memio.__setstate__(("no error", "", 0, {'spam': 3}))
00693         self.assertRaises(ValueError, memio.__setstate__, ("", "f", 0, None))
00694         self.assertRaises(ValueError, memio.__setstate__, ("", "", -1, None))
00695         self.assertRaises(TypeError, memio.__setstate__, (b"", "", 0, None))
00696         self.assertRaises(TypeError, memio.__setstate__, ("", b"", 0, None))
00697         self.assertRaises(TypeError, memio.__setstate__, ("", "", 0.0, None))
00698         self.assertRaises(TypeError, memio.__setstate__, ("", "", 0, 0))
00699         self.assertRaises(TypeError, memio.__setstate__, ("len-test", 0))
00700         self.assertRaises(TypeError, memio.__setstate__)
00701         self.assertRaises(TypeError, memio.__setstate__, 0)
00702         memio.close()
00703         self.assertRaises(ValueError, memio.__setstate__, ("closed", "", 0, None))
00704 

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 530 of file test_memoryio.py.

00530 
00531     def test_textio_properties(self):
00532         memio = self.ioclass()
00533 
00534         # These are just dummy values but we nevertheless check them for fear
00535         # of unexpected breakage.
00536         self.assertIsNone(memio.encoding)
00537         self.assertIsNone(memio.errors)
00538         self.assertFalse(memio.line_buffering)

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 664 of file test_memoryio.py.

00664 
00665     def test_widechar(self):
00666         buf = self.buftype("\U0002030a\U00020347")
00667         memio = self.ioclass(buf)
00668 
00669         self.assertEqual(memio.getvalue(), buf)
00670         self.assertEqual(memio.write(buf), len(buf))
00671         self.assertEqual(memio.tell(), len(buf))
00672         self.assertEqual(memio.getvalue(), buf)
00673         self.assertEqual(memio.write(buf), len(buf))
00674         self.assertEqual(memio.tell(), len(buf) * 2)
00675         self.assertEqual(memio.getvalue(), buf + buf)

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

Definition at line 607 of file test_memoryio.py.

Definition at line 610 of file test_memoryio.py.

Reimplemented from test.test_memoryio.PyStringIOTest.

Definition at line 659 of file test_memoryio.py.

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

Reimplemented from test.test_memoryio.PyStringIOTest.

Definition at line 660 of file test_memoryio.py.


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