cpython: 3e5200abf8eb (original) (raw)
Mercurial > cpython
changeset 70514:3e5200abf8eb
Issue #1625: Add stream ordering test to test_bz2. [#1625]
Nadeem Vawda nadeem.vawda@gmail.com | |
---|---|
date | Mon, 30 May 2011 01:58:12 +0200 |
parents | 659af4976568 |
children | 3089f7ff9b30 |
files | Lib/test/test_bz2.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_bz2.py 11 |
line wrap: on
line diff
--- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -426,6 +426,17 @@ class BZ2FileTest(BaseTest): next(bz2f) self.assertEqual(bz2f.readlines(), [])
- def testMultiStreamOrdering(self):
# Test the ordering of streams when reading a multi-stream archive.[](#l1.8)
data1 = b"foo" * 1000[](#l1.9)
data2 = b"bar" * 1000[](#l1.10)
with BZ2File(self.filename, "w") as bz2f:[](#l1.11)
bz2f.write(data1)[](#l1.12)
with BZ2File(self.filename, "a") as bz2f:[](#l1.13)
bz2f.write(data2)[](#l1.14)
with BZ2File(self.filename) as bz2f:[](#l1.15)
self.assertEqual(bz2f.read(), data1 + data2)[](#l1.16)
+ # Tests for a BZ2File wrapping another file object: def testReadBytesIO(self):