|
16 | 16 | from test.support import import_helper |
17 | 17 | from test.support import threading_helper |
18 | 18 | from test.support.os_helper import unlink, FakePath |
19 | | -import _compression |
| 19 | +from compression._common import streams |
20 | 20 | import sys |
21 | 21 |
|
22 | 22 |
|
@@ -126,15 +126,15 @@ def testReadMultiStream(self): |
126 | 126 | def testReadMonkeyMultiStream(self): |
127 | 127 | # Test BZ2File.read() on a multi-stream archive where a stream |
128 | 128 | # boundary coincides with the end of the raw read buffer. |
129 | | - buffer_size = _compression.BUFFER_SIZE |
130 | | - _compression.BUFFER_SIZE = len(self.DATA) |
| 129 | + buffer_size = streams.BUFFER_SIZE |
| 130 | + streams.BUFFER_SIZE = len(self.DATA) |
131 | 131 | try: |
132 | 132 | self.createTempFile(streams=5) |
133 | 133 | with BZ2File(self.filename) as bz2f: |
134 | 134 | self.assertRaises(TypeError, bz2f.read, float()) |
135 | 135 | self.assertEqual(bz2f.read(), self.TEXT * 5) |
136 | 136 | finally: |
137 | | - _compression.BUFFER_SIZE = buffer_size |
| 137 | + streams.BUFFER_SIZE = buffer_size |
138 | 138 |
|
139 | 139 | def testReadTrailingJunk(self): |
140 | 140 | self.createTempFile(suffix=self.BAD_DATA) |
@@ -742,7 +742,7 @@ def testOpenPathLikeFilename(self): |
742 | 742 | def testDecompressLimited(self): |
743 | 743 | """Decompressed data buffering should be limited""" |
744 | 744 | bomb = bz2.compress(b'\0' * int(2e6), compresslevel=9) |
745 | | - self.assertLess(len(bomb), _compression.BUFFER_SIZE) |
| 745 | + self.assertLess(len(bomb), streams.BUFFER_SIZE) |
746 | 746 |
|
747 | 747 | decomp = BZ2File(BytesIO(bomb)) |
748 | 748 | self.assertEqual(decomp.read(1), b'\0') |
|
0 commit comments