summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipimport.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-09-14 05:10:45 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-09-14 05:10:45 (GMT)
commit8ee9edbf4514d8f20ca4bc9cddb5065a4fc24716 (patch)
treeb24d566206ab15f15e8c07f2db57af531d020175 /Lib/test/test_zipimport.py
parentf6365e381620d95a112720d9f18ab6137882ecca (diff)
parent4aa74c429cabef6aaf91b2b0d4c2163778b1249d (diff)
downloadcpython-8ee9edbf4514d8f20ca4bc9cddb5065a4fc24716.zip
cpython-8ee9edbf4514d8f20ca4bc9cddb5065a4fc24716.tar.gz
cpython-8ee9edbf4514d8f20ca4bc9cddb5065a4fc24716.tar.bz2
Issue #28131: Merge from 3.5
Diffstat (limited to 'Lib/test/test_zipimport.py')
-rw-r--r--Lib/test/test_zipimport.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index a7e680d..7ddbc50 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -532,6 +532,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