diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-11 11:41:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-11 11:41:02 (GMT) |
commit | 5f1a5187f72acb75d59fa67286ecf5c186bae619 (patch) | |
tree | c5bca32d17d3251b8887ddaa10273a7df19a0eaa /Lib/test/test_bz2.py | |
parent | ab8740058a7f76f1438dc18a2ffd918da4f8118d (diff) | |
download | cpython-5f1a5187f72acb75d59fa67286ecf5c186bae619.zip cpython-5f1a5187f72acb75d59fa67286ecf5c186bae619.tar.gz cpython-5f1a5187f72acb75d59fa67286ecf5c186bae619.tar.bz2 |
Use sequence repetition instead of bytes constructor with integer argument.
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r-- | Lib/test/test_bz2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py index a1e4b8d..450ab2e 100644 --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -562,11 +562,11 @@ class BZ2FileTest(BaseTest): def testDecompressLimited(self): """Decompressed data buffering should be limited""" - bomb = bz2.compress(bytes(int(2e6)), compresslevel=9) + bomb = bz2.compress(b'\0' * int(2e6), compresslevel=9) self.assertLess(len(bomb), _compression.BUFFER_SIZE) decomp = BZ2File(BytesIO(bomb)) - self.assertEqual(bytes(1), decomp.read(1)) + self.assertEqual(decomp.read(1), b'\0') max_decomp = 1 + DEFAULT_BUFFER_SIZE self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp, "Excessive amount of data was decompressed") |