summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Pipek <jan.pipek@gmail.com>2019-09-10 17:44:33 +0200
committerIlya Etingof <etingof@gmail.com>2019-11-15 19:31:42 +0100
commit8446ab5f523cb78707ef3aa0532c29ffda6db9b5 (patch)
treebfa2a889b893d25e6755a746a1167d9769eeed2d /tests
parente279319d412c6d7045c8bf90d0d887ed5097ff29 (diff)
downloadpyasn1-git-8446ab5f523cb78707ef3aa0532c29ffda6db9b5.tar.gz
Additional test on ZIP files
Diffstat (limited to 'tests')
-rw-r--r--tests/codec/ber/test_decoder.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/codec/ber/test_decoder.py b/tests/codec/ber/test_decoder.py
index 141f7c7..db09af0 100644
--- a/tests/codec/ber/test_decoder.py
+++ b/tests/codec/ber/test_decoder.py
@@ -1720,6 +1720,20 @@ class CompressedFilesTestCase(BaseTestCase):
finally:
os.remove(path)
+ def testZipfileMany(self):
+ _, path = tempfile.mkstemp(suffix=".zip")
+ try:
+ with zipfile.ZipFile(path, "w") as myzip:
+ #for i in range(100):
+ myzip.writestr("data", ints2octs((2, 1, 12, 35, 128, 3, 2, 0, 169, 3, 2, 1, 138, 0, 0)) * 1000)
+
+ with zipfile.ZipFile(path, "r") as myzip:
+ with myzip.open("data", "r") as source:
+ values = list(decoder.decodeStream(source))
+ assert values == [12, (1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1)] * 1000
+ finally:
+ os.remove(path)
+
suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])