mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #25590: Merge rlcompleter change from 3.4 into 3.5
This commit is contained in:
commit
fa9ea04673
3 changed files with 26 additions and 7 deletions
|
@ -64,6 +64,19 @@ class TestRlcompleter(unittest.TestCase):
|
|||
['egg.{}('.format(x) for x in dir(str)
|
||||
if x.startswith('s')])
|
||||
|
||||
def test_excessive_getattr(self):
|
||||
# Ensure getattr() is invoked no more than once per attribute
|
||||
class Foo:
|
||||
calls = 0
|
||||
@property
|
||||
def bar(self):
|
||||
self.calls += 1
|
||||
return None
|
||||
f = Foo()
|
||||
completer = rlcompleter.Completer(dict(f=f))
|
||||
self.assertEqual(completer.complete('f.b', 0), 'f.bar')
|
||||
self.assertEqual(f.calls, 1)
|
||||
|
||||
def test_complete(self):
|
||||
completer = rlcompleter.Completer()
|
||||
self.assertEqual(completer.complete('', 0), '\t')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue