diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-04 21:36:24 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-04 21:36:24 (GMT) |
commit | 6cbb20cdf61329ebfa6afcacad21ee6252fb5be5 (patch) | |
tree | a0493b69a4f5d2ac3cafa4e0b20efa5f3a856cef /Lib/test/test_lzma.py | |
parent | 33c34da5745f2e3fdc315e5098295621d8023674 (diff) | |
download | cpython-6cbb20cdf61329ebfa6afcacad21ee6252fb5be5.zip cpython-6cbb20cdf61329ebfa6afcacad21ee6252fb5be5.tar.gz cpython-6cbb20cdf61329ebfa6afcacad21ee6252fb5be5.tar.bz2 |
Allow LZMAFile to accept modes with a "b" suffix.
Diffstat (limited to 'Lib/test/test_lzma.py')
-rw-r--r-- | Lib/test/test_lzma.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py index aee7921..e4d2cb1 100644 --- a/Lib/test/test_lzma.py +++ b/Lib/test/test_lzma.py @@ -374,6 +374,21 @@ class FileTestCase(unittest.TestCase): with LZMAFile(TESTFN, "a") as f: pass + def test_init_mode(self): + with TempFile(TESTFN): + with LZMAFile(TESTFN, "r"): + pass + with LZMAFile(TESTFN, "rb"): + pass + with LZMAFile(TESTFN, "w"): + pass + with LZMAFile(TESTFN, "wb"): + pass + with LZMAFile(TESTFN, "a"): + pass + with LZMAFile(TESTFN, "ab"): + pass + def test_init_bad_mode(self): with self.assertRaises(ValueError): LZMAFile(BytesIO(COMPRESSED_XZ), (3, "x")) @@ -382,11 +397,11 @@ class FileTestCase(unittest.TestCase): with self.assertRaises(ValueError): LZMAFile(BytesIO(COMPRESSED_XZ), "x") with self.assertRaises(ValueError): - LZMAFile(BytesIO(COMPRESSED_XZ), "rb") + LZMAFile(BytesIO(COMPRESSED_XZ), "rt") with self.assertRaises(ValueError): LZMAFile(BytesIO(COMPRESSED_XZ), "r+") with self.assertRaises(ValueError): - LZMAFile(BytesIO(COMPRESSED_XZ), "wb") + LZMAFile(BytesIO(COMPRESSED_XZ), "wt") with self.assertRaises(ValueError): LZMAFile(BytesIO(COMPRESSED_XZ), "w+") with self.assertRaises(ValueError): |