diff options
| author | Benjamin Peterson <benjamin@python.org> | 2016-09-13 22:46:37 -0700 | 
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2016-09-13 22:46:37 -0700 | 
| commit | 1f28a4749ba0dd85686b17bd649b0de0dd584b1a (patch) | |
| tree | e1e60f88e097645067c5bc6c7cee49023c4a19c6 /Lib | |
| parent | 59e5e0dca2af635ebe0098ef8c2673664e2bde59 (diff) | |
| parent | e9078859322cbf67576b57aa0ad366ca4097f8c1 (diff) | |
| download | cpython-git-1f28a4749ba0dd85686b17bd649b0de0dd584b1a.tar.gz | |
merge heads
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_zipimport.py | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 2bb7230c26..d5b3b22ae1 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -513,6 +513,19 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):                   "some.data": (NOW, "some data")}          self.doTest(pyc_ext, files, TESTMOD) +    def testDefaultOptimizationLevel(self): +        # zipimport should use the default optimization level (#28131) +        src = """if 1:  # indent hack +        def test(val): +            assert(val) +            return val\n""" +        files = {TESTMOD + '.py': (NOW, src)} +        self.makeZip(files) +        sys.path.insert(0, TEMP_ZIP) +        mod = importlib.import_module(TESTMOD) +        self.assertEqual(mod.test(1), 1) +        self.assertRaises(AssertionError, mod.test, False) +      def testImport_WithStuff(self):          # try importing from a zipfile which contains additional          # stuff at the beginning of the file  | 
