|
3 | 3 | import unittest |
4 | 4 | from test.support import requires |
5 | 5 | from tkinter import Tk, Text |
| 6 | +import __main__ |
6 | 7 |
|
7 | 8 | import idlelib.autocomplete as ac |
8 | 9 | import idlelib.autocomplete_w as acw |
@@ -35,7 +36,7 @@ def tearDownClass(cls): |
35 | 36 | del cls.root |
36 | 37 |
|
37 | 38 | def setUp(self): |
38 | | - self.editor.text.delete('1.0', 'end') |
| 39 | + self.text.delete('1.0', 'end') |
39 | 40 | self.autocomplete = ac.AutoComplete(self.editor) |
40 | 41 |
|
41 | 42 | def test_init(self): |
@@ -132,12 +133,16 @@ def test_fetch_completions(self): |
132 | 133 | # a small list containing non-private variables. |
133 | 134 | # For file completion, a large list containing all files in the path, |
134 | 135 | # and a small list containing files that do not start with '.' |
135 | | - pass |
| 136 | + small, large = self.autocomplete.fetch_completions( |
| 137 | + '', ac.COMPLETE_ATTRIBUTES) |
| 138 | + self.assertLess(len(small), len(large)) |
| 139 | + if __main__.__file__ != ac.__file__: |
| 140 | + self.assertNotIn('AutoComplete', small) # See issue 36405. |
136 | 141 |
|
137 | 142 | def test_get_entity(self): |
138 | 143 | # Test that a name is in the namespace of sys.modules and |
139 | 144 | # __main__.__dict__ |
140 | | - pass |
| 145 | + self.assertEqual(self.autocomplete.get_entity('int'), int) |
141 | 146 |
|
142 | 147 |
|
143 | 148 | if __name__ == '__main__': |
|
0 commit comments