diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2019-03-24 21:12:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-24 21:12:28 (GMT) |
commit | 0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9 (patch) | |
tree | cf882c27dc64daf2d58af7a67a5adc2e5559129c /Lib/idlelib/idle_test/test_autocomplete.py | |
parent | 6661c1720ebd322e2cb6995a243e8dc6e588d931 (diff) | |
download | cpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.zip cpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.tar.gz cpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.tar.bz2 |
bpo-36405: IDLE - Restore __main__ and add tests (#12518)
Fix error in commit 2b75155 noticed by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib/idle_test/test_autocomplete.py')
-rw-r--r-- | Lib/idlelib/idle_test/test_autocomplete.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py index d7ee00a..89a9ed1 100644 --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -3,6 +3,7 @@ import unittest from test.support import requires from tkinter import Tk, Text +import __main__ import idlelib.autocomplete as ac import idlelib.autocomplete_w as acw @@ -35,7 +36,7 @@ class AutoCompleteTest(unittest.TestCase): del cls.root def setUp(self): - self.editor.text.delete('1.0', 'end') + self.text.delete('1.0', 'end') self.autocomplete = ac.AutoComplete(self.editor) def test_init(self): @@ -132,12 +133,16 @@ class AutoCompleteTest(unittest.TestCase): # a small list containing non-private variables. # For file completion, a large list containing all files in the path, # and a small list containing files that do not start with '.' - pass + small, large = self.autocomplete.fetch_completions( + '', ac.COMPLETE_ATTRIBUTES) + self.assertLess(len(small), len(large)) + if __main__.__file__ != ac.__file__: + self.assertNotIn('AutoComplete', small) # See issue 36405. def test_get_entity(self): # Test that a name is in the namespace of sys.modules and # __main__.__dict__ - pass + self.assertEqual(self.autocomplete.get_entity('int'), int) if __name__ == '__main__': |