summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-05-29 23:58:12 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-05-29 23:58:12 (GMT)
commitf3ecb8382222577ce9aef9901b91c9ba69a41f32 (patch)
treede20804a7d1861d66460fde5803bb26709c5c3c2 /Lib/test/test_bz2.py
parent07d291ae595ef2414e35688dfba9a9f25361cda5 (diff)
downloadcpython-f3ecb8382222577ce9aef9901b91c9ba69a41f32.zip
cpython-f3ecb8382222577ce9aef9901b91c9ba69a41f32.tar.gz
cpython-f3ecb8382222577ce9aef9901b91c9ba69a41f32.tar.bz2
Issue #1625: Add stream ordering test to test_bz2.
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r--Lib/test/test_bz2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 350d2de..e2c34d5 100644
--- 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.
+ data1 = b"foo" * 1000
+ data2 = b"bar" * 1000
+ with BZ2File(self.filename, "w") as bz2f:
+ bz2f.write(data1)
+ with BZ2File(self.filename, "a") as bz2f:
+ bz2f.write(data2)
+ with BZ2File(self.filename) as bz2f:
+ self.assertEqual(bz2f.read(), data1 + data2)
+
# Tests for a BZ2File wrapping another file object:
def testReadBytesIO(self):