FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
scrapy/tests/test_utils_console.py at master · jackcoolpython/scrapy · GitHub
jackcoolpython
scrapy
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
scrapy
/
tests
/
test_utils_console.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (33 loc) · 1.15 KB
Breadcrumbs
scrapy
/
tests
/
test_utils_console.py
Copy path
File metadata and controls
45 lines (33 loc) · 1.15 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
37
38
39
40
41
42
43
44
45
import
unittest
from
scrapy
.
utils
.
console
import
get_shell_embed_func
try
:
import
bpython
bpy
=
True
del
bpython
except
ImportError
:
bpy
=
False
try
:
import
IPython
ipy
=
True
del
IPython
except
ImportError
:
ipy
=
False
class
UtilsConsoleTestCase
(
unittest
.
TestCase
):
def
test_get_shell_embed_func
(
self
):
shell
=
get_shell_embed_func
([
'invalid'
])
self
.
assertEqual
(
shell
,
None
)
shell
=
get_shell_embed_func
([
'invalid'
,
'python'
])
self
.
assertTrue
(
callable
(
shell
))
self
.
assertEqual
(
shell
.
__name__
,
'_embed_standard_shell'
)
@
unittest
.
skipIf
(
not
bpy
,
'bpython not available in testenv'
)
def
test_get_shell_embed_func2
(
self
):
shell
=
get_shell_embed_func
([
'bpython'
])
self
.
assertTrue
(
callable
(
shell
))
self
.
assertEqual
(
shell
.
__name__
,
'_embed_bpython_shell'
)
@
unittest
.
skipIf
(
not
ipy
,
'IPython not available in testenv'
)
def
test_get_shell_embed_func3
(
self
):
# default shell should be 'ipython'
shell
=
get_shell_embed_func
()
self
.
assertEqual
(
shell
.
__name__
,
'_embed_ipython_shell'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL