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