summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2017-10-01 00:32:29 (GMT)
committerGitHub <noreply@github.com>2017-10-01 00:32:29 (GMT)
commitc8198c92320bc35b1e3de5ff0118bd8e20e8d68a (patch)
tree89d4597b946f265dc65127fcc3aaedcf95d82df0 /Lib/idlelib/idle_test
parent40c54d5e1aaab91cb7df71f735112d20b5e5b755 (diff)
downloadcpython-c8198c92320bc35b1e3de5ff0118bd8e20e8d68a.zip
cpython-c8198c92320bc35b1e3de5ff0118bd8e20e8d68a.tar.gz
cpython-c8198c92320bc35b1e3de5ff0118bd8e20e8d68a.tar.bz2
[3.6] bpo-31460: Simplify the API of IDLE's Module Browser. (GH-3842) (#3843)
Passing a widget instead of an flist with a root widget opens the option of creating a browser frame that is only part of a window. Passing a full file name instead of pieces assumed to come from a .py file opens the possibility of browsing python files that do not end in .py. (cherry picked from commit d6bb65f)
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_browser.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py
index b9ae041..c818495 100644
--- a/Lib/idlelib/idle_test/test_browser.py
+++ b/Lib/idlelib/idle_test/test_browser.py
@@ -24,30 +24,24 @@ class ModuleBrowserTest(unittest.TestCase):
requires('gui')
cls.root = Tk()
cls.root.withdraw()
- cls.flist = filelist.FileList(cls.root)
- cls.file = __file__
- cls.path = os.path.dirname(cls.file)
- cls.module = os.path.basename(cls.file).rstrip('.py')
- cls.mb = browser.ModuleBrowser(cls.flist, cls.module, [cls.path], _utest=True)
+ cls.mb = browser.ModuleBrowser(cls.root, __file__, _utest=True)
@classmethod
def tearDownClass(cls):
cls.mb.close()
cls.root.destroy()
- del cls.root, cls.flist, cls.mb
+ del cls.root, cls.mb
def test_init(self):
mb = self.mb
eq = self.assertEqual
- eq(mb.name, self.module)
- eq(mb.file, self.file)
- eq(mb.flist, self.flist)
+ eq(mb.path, __file__)
eq(pyclbr._modules, {})
self.assertIsInstance(mb.node, TreeNode)
def test_settitle(self):
mb = self.mb
- self.assertIn(self.module, mb.top.title())
+ self.assertIn(os.path.basename(__file__), mb.top.title())
self.assertEqual(mb.top.iconname(), 'Module Browser')
def test_rootnode(self):