summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-10-02 17:07:06 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-10-02 17:07:06 (GMT)
commit8bdd4480c46bea97788c45323329ebd54c91242f (patch)
treeab289912cc95bcb9e40d9a703e20aae5e506553a /Lib/test
parent03020cfa97b6c2c80f50fb2d07025aff49c3513c (diff)
downloadcpython-8bdd4480c46bea97788c45323329ebd54c91242f.zip
cpython-8bdd4480c46bea97788c45323329ebd54c91242f.tar.gz
cpython-8bdd4480c46bea97788c45323329ebd54c91242f.tar.bz2
Issue #28225: bz2 module now supports pathlib
Initial patch by Ethan Furman.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bz2.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 46ad2c4..482242c 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -6,6 +6,7 @@ from io import BytesIO, DEFAULT_BUFFER_SIZE
import os
import pickle
import glob
+import pathlib
import random
import subprocess
import sys
@@ -560,6 +561,13 @@ class BZ2FileTest(BaseTest):
with BZ2File(str_filename, "rb") as f:
self.assertEqual(f.read(), self.DATA)
+ def testOpenPathLikeFilename(self):
+ filename = pathlib.Path(self.filename)
+ with BZ2File(filename, "wb") as f:
+ f.write(self.DATA)
+ with BZ2File(filename, "rb") as f:
+ self.assertEqual(f.read(), self.DATA)
+
def testDecompressLimited(self):
"""Decompressed data buffering should be limited"""
bomb = bz2.compress(b'\0' * int(2e6), compresslevel=9)