mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	This follows the previous patch that changed idlelib file names. Class names that matched old module names are not changed. Change idlelib imports in turtledemo.__main__. Exception: config-extensions.def. Previously, extension section names, file names, and class names had to match. Changing section names would create cross-version conflicts in config-extensions.cfg (user customizations). Instead map old names to new file names at point of import in editor.EditorWindow.load_extension. Patch extensively tested with test_idle, idle_test.htest.py, a custom import-all test, running IDLE in a console to catch messages, and testing each menu item. Based on a patch by Al Sweigart.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			882 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			882 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import unittest
 | 
						|
import os
 | 
						|
import sys
 | 
						|
import idlelib
 | 
						|
from idlelib import pathbrowser
 | 
						|
 | 
						|
class PathBrowserTest(unittest.TestCase):
 | 
						|
 | 
						|
    def test_DirBrowserTreeItem(self):
 | 
						|
        # 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)
 |