Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests for from ... import *, issue #615

  • Loading branch information...
commit ef3c0e4e3fd819389b6e975f1736a3de407f08ec 1 parent b3424c5
Daniel Kluev authored
View
7 examples/libtest/BuiltinTest.py
@@ -282,6 +282,13 @@ def testImport(self):
import imports
self.assertTrue(CLS is imports.loccls.CLS, "CLS is imports.loccls.CLS")
self.assertTrue(CLS is imports.upcls.CLS, "CLS is imports.upcls.CLS")
+
+ # from ... import * tests, issue #615
+ self.assertEqual(imports.all_masked, False, "from ... import * should respect __all__, #615")
+ self.assertEqual(imports.all_override, True, "Should override globals, #615")
+ self.assertEqual(imports.all_import1, 1)
+ self.assertEqual(imports.all_import2, 3)
+ self.assertEqual(imports.all_import3, 3)
def testBitOperations(self):
self.assertEqual(1 << 2 - 1, 2, "shift error 1")
View
6 examples/libtest/imports/__init__.py
@@ -24,3 +24,9 @@ def conditional_func():
if True:
def conditional_func():
return "overridden"
+
+# Import all
+all_masked = False
+all_override = False
+from allwith__all__ import *
+from allsimple import *
View
7 examples/libtest/imports/allsimple.py
@@ -0,0 +1,7 @@
+"""
+Helper module for import * without __all__
+"""
+
+all_import2 = 3
+all_import3 = 3
+all_override = True
View
8 examples/libtest/imports/allwith__all__.py
@@ -0,0 +1,8 @@
+"""
+Helper module for import *, using __all__
+"""
+__all__ = ['all_import1', 'all_import2']
+
+all_import1 = 1
+all_import2 = 2
+all_masked = True
Please sign in to comment.
Something went wrong with that request. Please try again.