Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a8b5c587
Commit
a8b5c587
authored
Aug 04, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9496: Provide a test suite for the rlcompleter module. Patch by
Michele Orrù.
parent
4c0d7228
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
Lib/test/test_rlcompleter.py
Lib/test/test_rlcompleter.py
+73
-0
Lib/test/test_sundry.py
Lib/test/test_sundry.py
+0
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_rlcompleter.py
0 → 100644
View file @
a8b5c587
from
test
import
support
import
unittest
import
builtins
import
rlcompleter
class
CompleteMe
:
""" Trivial class used in testing rlcompleter.Completer. """
spam
=
1
class
TestRlcompleter
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
stdcompleter
=
rlcompleter
.
Completer
()
self
.
completer
=
rlcompleter
.
Completer
(
dict
(
spam
=
int
,
egg
=
str
,
CompleteMe
=
CompleteMe
))
# forces stdcompleter to bind builtins namespace
self
.
stdcompleter
.
complete
(
''
,
0
)
def
test_namespace
(
self
):
class
A
(
dict
):
pass
class
B
(
list
):
pass
self
.
assertTrue
(
self
.
stdcompleter
.
use_main_ns
)
self
.
assertFalse
(
self
.
completer
.
use_main_ns
)
self
.
assertFalse
(
rlcompleter
.
Completer
(
A
()).
use_main_ns
)
self
.
assertRaises
(
TypeError
,
rlcompleter
.
Completer
,
B
((
1
,)))
def
test_global_matches
(
self
):
# test with builtins namespace
self
.
assertEqual
(
self
.
stdcompleter
.
global_matches
(
'di'
),
[
x
+
'('
for
x
in
dir
(
builtins
)
if
x
.
startswith
(
'di'
)])
self
.
assertEqual
(
self
.
stdcompleter
.
global_matches
(
'st'
),
[
x
+
'('
for
x
in
dir
(
builtins
)
if
x
.
startswith
(
'st'
)])
self
.
assertEqual
(
self
.
stdcompleter
.
global_matches
(
'akaksajadhak'
),
[])
# test with a customized namespace
self
.
assertEqual
(
self
.
completer
.
global_matches
(
'CompleteM'
),
[
'CompleteMe('
])
self
.
assertEqual
(
self
.
completer
.
global_matches
(
'eg'
),
[
'egg('
])
# XXX: see issue5256
self
.
assertEqual
(
self
.
completer
.
global_matches
(
'CompleteM'
),
[
'CompleteMe('
])
def
test_attr_matches
(
self
):
# test with builtins namespace
self
.
assertEqual
(
self
.
stdcompleter
.
attr_matches
(
'str.s'
),
[
'str.{}('
.
format
(
x
)
for
x
in
dir
(
str
)
if
x
.
startswith
(
's'
)])
self
.
assertEqual
(
self
.
stdcompleter
.
attr_matches
(
'tuple.foospamegg'
),
[])
# test with a customized namespace
self
.
assertEqual
(
self
.
completer
.
attr_matches
(
'CompleteMe.sp'
),
[
'CompleteMe.spam'
])
self
.
assertEqual
(
self
.
completer
.
attr_matches
(
'Completeme.egg'
),
[])
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'
)])
def
test_main
():
support
.
run_unittest
(
TestRlcompleter
)
if
__name__
==
'__main__'
:
test_main
()
Lib/test/test_sundry.py
View file @
a8b5c587
...
...
@@ -56,7 +56,6 @@ class TestUntestedModules(unittest.TestCase):
import
os2emxpath
import
pstats
import
py_compile
import
rlcompleter
import
sndhdr
import
symbol
import
tabnanny
...
...
Misc/ACKS
View file @
a8b5c587
...
...
@@ -591,6 +591,7 @@ Grant Olson
Piet van Oostrum
Jason Orendorff
Douglas Orr
Michele Orrù
Denis S. Otkidach
Michael Otteneder
R. M. Oudkerk
...
...
Misc/NEWS
View file @
a8b5c587
...
...
@@ -108,6 +108,9 @@ Tools/Demos
Tests
-----
- Issue #9496: Provide a test suite for the rlcompleter module. Patch by
Michele Orrù.
- Issue #8687: provide a test suite for sched.py module.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment