Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_rlcompleter.TestRlcompleter Class Reference

List of all members.

Public Member Functions

def setUp
def test_namespace
def test_global_matches
def test_attr_matches

Public Attributes

 stdcompleter
 completer

Detailed Description

Definition at line 11 of file test_rlcompleter.py.


Member Function Documentation

Definition at line 12 of file test_rlcompleter.py.

00012 
00013     def setUp(self):
00014         self.stdcompleter = rlcompleter.Completer()
00015         self.completer = rlcompleter.Completer(dict(spam=int,
00016                                                     egg=str,
00017                                                     CompleteMe=CompleteMe))
00018 
00019         # forces stdcompleter to bind builtins namespace
00020         self.stdcompleter.complete('', 0)

Here is the caller graph for this function:

Definition at line 49 of file test_rlcompleter.py.

00049 
00050     def test_attr_matches(self):
00051         # test with builtins namespace
00052         self.assertEqual(self.stdcompleter.attr_matches('str.s'),
00053                          ['str.{}('.format(x) for x in dir(str)
00054                           if x.startswith('s')])
00055         self.assertEqual(self.stdcompleter.attr_matches('tuple.foospamegg'), [])
00056 
00057         # test with a customized namespace
00058         self.assertEqual(self.completer.attr_matches('CompleteMe.sp'),
00059                          ['CompleteMe.spam'])
00060         self.assertEqual(self.completer.attr_matches('Completeme.egg'), [])
00061 
00062         CompleteMe.me = CompleteMe
00063         self.assertEqual(self.completer.attr_matches('CompleteMe.me.me.sp'),
00064                          ['CompleteMe.me.me.spam'])
00065         self.assertEqual(self.completer.attr_matches('egg.s'),
00066                          ['egg.{}('.format(x) for x in dir(str)
00067                           if x.startswith('s')])

Here is the call graph for this function:

Definition at line 32 of file test_rlcompleter.py.

00032 
00033     def test_global_matches(self):
00034         # test with builtins namespace
00035         self.assertEqual(sorted(self.stdcompleter.global_matches('di')),
00036                          [x+'(' for x in dir(builtins) if x.startswith('di')])
00037         self.assertEqual(sorted(self.stdcompleter.global_matches('st')),
00038                          [x+'(' for x in dir(builtins) if x.startswith('st')])
00039         self.assertEqual(self.stdcompleter.global_matches('akaksajadhak'), [])
00040 
00041         # test with a customized namespace
00042         self.assertEqual(self.completer.global_matches('CompleteM'),
00043                          ['CompleteMe('])
00044         self.assertEqual(self.completer.global_matches('eg'),
00045                          ['egg('])
00046         # XXX: see issue5256
00047         self.assertEqual(self.completer.global_matches('CompleteM'),
00048                          ['CompleteMe('])

Here is the call graph for this function:

Definition at line 21 of file test_rlcompleter.py.

00021 
00022     def test_namespace(self):
00023         class A(dict):
00024             pass
00025         class B(list):
00026             pass
00027 
00028         self.assertTrue(self.stdcompleter.use_main_ns)
00029         self.assertFalse(self.completer.use_main_ns)
00030         self.assertFalse(rlcompleter.Completer(A()).use_main_ns)
00031         self.assertRaises(TypeError, rlcompleter.Completer, B((1,)))


Member Data Documentation

Definition at line 14 of file test_rlcompleter.py.

Definition at line 13 of file test_rlcompleter.py.


The documentation for this class was generated from the following file: