2013-05-27 22:32:03 -03:00
|
|
|
import unittest
|
2015-07-20 18:44:59 -03:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import idlelib
|
|
|
|
from idlelib import PathBrowser
|
2013-05-27 22:32:03 -03:00
|
|
|
|
|
|
|
class PathBrowserTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_DirBrowserTreeItem(self):
|
|
|
|
# Issue16226 - make sure that getting a sublist works
|
|
|
|
d = PathBrowser.DirBrowserTreeItem('')
|
|
|
|
d.GetSubList()
|
2015-07-20 18:44:59 -03:00
|
|
|
self.assertEqual('', d.GetText())
|
|
|
|
|
|
|
|
dir = os.path.split(os.path.abspath(idlelib.__file__))[0]
|
|
|
|
self.assertEqual(d.ispackagedir(dir), True)
|
|
|
|
self.assertEqual(d.ispackagedir(dir + '/Icons'), False)
|
|
|
|
|
|
|
|
def test_PathBrowserTreeItem(self):
|
|
|
|
p = PathBrowser.PathBrowserTreeItem()
|
|
|
|
self.assertEqual(p.GetText(), 'sys.path')
|
|
|
|
sub = p.GetSubList()
|
|
|
|
self.assertEqual(len(sub), len(sys.path))
|
|
|
|
self.assertEqual(type(sub[0]), PathBrowser.DirBrowserTreeItem)
|
2013-05-27 22:32:03 -03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(verbosity=2, exit=False)
|