FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bpython/bpython/test/test_autocomplete.py at master · susinmotion/bpython · GitHub
susinmotion
/
bpython
Public
forked from
bpython/bpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
bpython
/
bpython
/
test
/
test_autocomplete.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (30 loc) · 1.31 KB
Breadcrumbs
bpython
/
bpython
/
test
/
test_autocomplete.py
Copy path
File metadata and controls
36 lines (30 loc) · 1.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from
bpython
import
autocomplete
from
functools
import
partial
import
inspect
import
unittest
try
:
from
unittest
import
skip
except
ImportError
:
def
skip
(
f
):
return
lambda
self
:
None
#TODO: Parts of autocompletion to test:
# Test that the right matches come back from find_matches (test that priority is correct)
# Test the various complete methods (import, filename) to see if right matches
# Test that MatchesIterator.substitute correctly subs given a match and a completer
class
TestSafeEval
(
unittest
.
TestCase
):
def
test_catches_syntax_error
(
self
):
try
:
autocomplete
.
safe_eval
(
'1re'
,{})
except
:
self
.
fail
(
'safe_eval raises an error'
)
class
TestFormatters
(
unittest
.
TestCase
):
def
test_filename
(
self
):
last_part_of_filename
=
autocomplete
.
FilenameCompletion
.
format
self
.
assertEqual
(
last_part_of_filename
(
'abc'
),
'abc'
)
self
.
assertEqual
(
last_part_of_filename
(
'abc/'
),
'abc/'
)
self
.
assertEqual
(
last_part_of_filename
(
'abc/efg'
),
'efg'
)
self
.
assertEqual
(
last_part_of_filename
(
'abc/efg/'
),
'efg/'
)
self
.
assertEqual
(
last_part_of_filename
(
'/abc'
),
'abc'
)
self
.
assertEqual
(
last_part_of_filename
(
'ab.c/e.f.g/'
),
'e.f.g/'
)
def
test_attribute
(
self
):
self
.
assertEqual
(
autocomplete
.
after_last_dot
(
'abc.edf'
),
'edf'
)
Back
|
FazBrowse Home
|
New Git URL