From d6bb65f378e34fe0c11fdb39588357ecf22964eb Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 30 Sep 2017 19:54:28 -0400 Subject: bpo-31460: Simplify the API of IDLE's Module Browser. (#3842) 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. --- Lib/idlelib/idle_test/test_browser.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Lib/idlelib/idle_test') diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py index a4add89b93..59e03c5aab 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): -- cgit v1.2.1