ยปCore Development>Code coverage>Lib/idlelib/idle_test/test_pathbrowser.py

Python code coverage for Lib/idlelib/idle_test/test_pathbrowser.py

#countcontent
1n/aimport unittest
2n/aimport os
3n/aimport sys
4n/aimport idlelib
5n/afrom idlelib import pathbrowser
6n/a
7n/aclass PathBrowserTest(unittest.TestCase):
8n/a
9n/a def test_DirBrowserTreeItem(self):
10n/a # Issue16226 - make sure that getting a sublist works
11n/a d = pathbrowser.DirBrowserTreeItem('')
12n/a d.GetSubList()
13n/a self.assertEqual('', d.GetText())
14n/a
15n/a dir = os.path.split(os.path.abspath(idlelib.__file__))[0]
16n/a self.assertEqual(d.ispackagedir(dir), True)
17n/a self.assertEqual(d.ispackagedir(dir + '/Icons'), False)
18n/a
19n/a def test_PathBrowserTreeItem(self):
20n/a p = pathbrowser.PathBrowserTreeItem()
21n/a self.assertEqual(p.GetText(), 'sys.path')
22n/a sub = p.GetSubList()
23n/a self.assertEqual(len(sub), len(sys.path))
24n/a self.assertEqual(type(sub[0]), pathbrowser.DirBrowserTreeItem)
25n/a
26n/aif __name__ == '__main__':
27n/a unittest.main(verbosity=2, exit=False)