From 85b6687e190731cdbde4de437f8e7a79bf6f7676 Mon Sep 17 00:00:00 2001 From: Jan Pipek Date: Tue, 10 Sep 2019 17:44:33 +0200 Subject: Additional test on ZIP files --- tests/codec/ber/test_decoder.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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__]) -- cgit v1.2.1