Commit 40062a11 authored by Martin Panter's avatar Martin Panter

Issue #25754: Allow test_rlcompleter to be run multiple times

parent 4f09806e
import unittest
from unittest.mock import patch
import builtins
import rlcompleter
......@@ -72,12 +73,12 @@ class TestRlcompleter(unittest.TestCase):
self.assertIn('CompleteMe.__name__', matches)
self.assertIn('CompleteMe.__new__(', matches)
CompleteMe.me = CompleteMe
self.assertEqual(self.completer.attr_matches('CompleteMe.me.me.sp'),
['CompleteMe.me.me.spam'])
self.assertEqual(self.completer.attr_matches('egg.s'),
['egg.{}('.format(x) for x in dir(str)
if x.startswith('s')])
with patch.object(CompleteMe, "me", CompleteMe, create=True):
self.assertEqual(self.completer.attr_matches('CompleteMe.me.me.sp'),
['CompleteMe.me.me.spam'])
self.assertEqual(self.completer.attr_matches('egg.s'),
['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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment