summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test
diff options
context:
space:
mode:
authorFlavian Hautbois <flavianh@sicara.com>2019-07-26 01:30:33 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2019-07-26 01:30:33 (GMT)
commit76b645124b3aaa34bc664eece43707c01ef1b382 (patch)
tree10aaa3e7e89080bd68128c4de544050599d261bf /Lib/tkinter/test
parentc4cda4369f4b8f33082890d16dfc364a90658ef6 (diff)
downloadcpython-76b645124b3aaa34bc664eece43707c01ef1b382.zip
cpython-76b645124b3aaa34bc664eece43707c01ef1b382.tar.gz
cpython-76b645124b3aaa34bc664eece43707c01ef1b382.tar.bz2
bpo-29446: tkinter 'import *' only imports what it should (GH-14864)
Add __all__ to tkinter.__init__ and submodules. Replace 'import *' with explicit imports in some submodules.
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_misc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py
index 1d1a3c2..9d5a93e 100644
--- a/Lib/tkinter/test/test_tkinter/test_misc.py
+++ b/Lib/tkinter/test/test_tkinter/test_misc.py
@@ -7,6 +7,20 @@ support.requires('gui')
class MiscTest(AbstractTkTest, unittest.TestCase):
+ def test_all(self):
+ self.assertIn("Widget", tkinter.__all__)
+ # Check that variables from tkinter.constants are also in tkinter.__all__
+ self.assertIn("CASCADE", tkinter.__all__)
+ self.assertIsNotNone(tkinter.CASCADE)
+ # Check that sys, re, and constants are not in tkinter.__all__
+ self.assertNotIn("re", tkinter.__all__)
+ self.assertNotIn("sys", tkinter.__all__)
+ self.assertNotIn("constants", tkinter.__all__)
+ # Check that an underscored functions is not in tkinter.__all__
+ self.assertNotIn("_tkerror", tkinter.__all__)
+ # Check that wantobjects is not in tkinter.__all__
+ self.assertNotIn("wantobjects", tkinter.__all__)
+
def test_repr(self):
t = tkinter.Toplevel(self.root, name='top')
f = tkinter.Frame(t, name='child')