summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_pathbrowser.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2015-07-20 21:44:59 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2015-07-20 21:44:59 (GMT)
commit19c1a8725ca21882fff8d24891de3f9ff24458ba (patch)
tree30de71c0cf6580831eb13aa4ff893bef8a049650 /Lib/idlelib/idle_test/test_pathbrowser.py
parentc0b1e0f868a8688b49399ec83c05bc318bb90916 (diff)
downloadcpython-19c1a8725ca21882fff8d24891de3f9ff24458ba.zip
cpython-19c1a8725ca21882fff8d24891de3f9ff24458ba.tar.gz
cpython-19c1a8725ca21882fff8d24891de3f9ff24458ba.tar.bz2
Issue #20792: Expand idle_test.test_pathbowser. Tweak file to not copy twice.
Original patch by Saimadhav Heblikar.
Diffstat (limited to 'Lib/idlelib/idle_test/test_pathbrowser.py')
-rw-r--r--Lib/idlelib/idle_test/test_pathbrowser.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/idlelib/idle_test/test_pathbrowser.py b/Lib/idlelib/idle_test/test_pathbrowser.py
index 7ad7c97..afb886f 100644
--- a/Lib/idlelib/idle_test/test_pathbrowser.py
+++ b/Lib/idlelib/idle_test/test_pathbrowser.py
@@ -1,5 +1,8 @@
import unittest
-import idlelib.PathBrowser as PathBrowser
+import os
+import sys
+import idlelib
+from idlelib import PathBrowser
class PathBrowserTest(unittest.TestCase):
@@ -7,6 +10,18 @@ class PathBrowserTest(unittest.TestCase):
# Issue16226 - make sure that getting a sublist works
d = PathBrowser.DirBrowserTreeItem('')
d.GetSubList()
+ 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)
if __name__ == '__main__':
unittest.main(verbosity=2, exit=False)