diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-03-05 12:47:42 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-03-05 12:47:42 (GMT) |
commit | 78be7df9e46ffff4ff97f25a0d68e6bb26e8fe3e (patch) | |
tree | 0d3bd832a57847b4718940c70b5d5ec4124e2432 /Lib/test/test_tarfile.py | |
parent | 409d8f2ebdf597837c593a40659949e5b15f457d (diff) | |
download | cpython-78be7df9e46ffff4ff97f25a0d68e6bb26e8fe3e.zip cpython-78be7df9e46ffff4ff97f25a0d68e6bb26e8fe3e.tar.gz cpython-78be7df9e46ffff4ff97f25a0d68e6bb26e8fe3e.tar.bz2 |
Patch #918101: Add tarfile open mode r|* for auto-detection of the
stream compression; add, for symmetry reasons, r:* as a synonym of r.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r-- | Lib/test/test_tarfile.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index a6c4c4a..cc5e505 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -181,6 +181,18 @@ class ReadStreamTest(ReadTest): stream.close() +class ReadAsteriskTest(ReadTest): + + def setUp(self): + mode = self.mode + self.sep + "*" + self.tar = tarfile.open(tarname(self.comp), mode) + +class ReadStreamAsteriskTest(ReadStreamTest): + + def setUp(self): + mode = self.mode + self.sep + "*" + self.tar = tarfile.open(tarname(self.comp), mode) + class WriteTest(BaseTest): mode = 'w' @@ -336,6 +348,11 @@ class WriteTestGzip(WriteTest): comp = "gz" class WriteStreamTestGzip(WriteStreamTest): comp = "gz" +class ReadAsteriskTestGzip(ReadAsteriskTest): + comp = "gz" +class ReadStreamAsteriskTestGzip(ReadStreamAsteriskTest): + comp = "gz" + # Filemode test cases @@ -355,6 +372,10 @@ if bz2: comp = "bz2" class WriteStreamTestBzip2(WriteStreamTestGzip): comp = "bz2" + class ReadAsteriskTestBzip2(ReadAsteriskTest): + comp = "bz2" + class ReadStreamAsteriskTestBzip2(ReadStreamAsteriskTest): + comp = "bz2" # If importing gzip failed, discard the Gzip TestCases. if not gzip: @@ -375,6 +396,8 @@ def test_main(): FileModeTest, ReadTest, ReadStreamTest, + ReadAsteriskTest, + ReadStreamAsteriskTest, WriteTest, WriteStreamTest, WriteGNULongTest, @@ -386,13 +409,15 @@ def test_main(): if gzip: tests.extend([ ReadTestGzip, ReadStreamTestGzip, - WriteTestGzip, WriteStreamTestGzip + WriteTestGzip, WriteStreamTestGzip, + ReadAsteriskTestGzip, ReadStreamAsteriskTestGzip ]) if bz2: tests.extend([ ReadTestBzip2, ReadStreamTestBzip2, - WriteTestBzip2, WriteStreamTestBzip2 + WriteTestBzip2, WriteStreamTestBzip2, + ReadAsteriskTestBzip2, ReadStreamAsteriskTestBzip2 ]) try: test_support.run_unittest(*tests) |