FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bpython/bpython/test/test_interpreter.py at unicode-output · di/bpython · GitHub
di
/
bpython
Public
forked from
bpython/bpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
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_interpreter.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (39 loc) · 1.82 KB
Breadcrumbs
bpython
/
bpython
/
test
/
test_interpreter.py
Copy path
File metadata and controls
56 lines (39 loc) · 1.82 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
46
47
48
49
50
51
52
53
54
from
__future__
import
unicode_literals
import
unittest
from
bpython
.
curtsiesfrontend
import
interpreter
from
bpython
.
curtsiesfrontend
.
repl
import
bad_empty_lines_removed
from
curtsies
.
fmtfuncs
import
*
class
TestInterpreter
(
unittest
.
TestCase
):
def
test_syntaxerror
(
self
):
i
=
interpreter
.
Interp
()
a
=
[]
def
append_to_a
(
message
):
a
.
append
(
message
)
i
.
write
=
append_to_a
i
.
runsource
(
'1.1.1.1'
)
expected
=
''
+
''
+
' File '
+
green
(
'"<input>"'
)
+
', line '
+
bold
(
magenta
(
'1'
))
+
'
\n
'
+
' '
+
'1.1'
+
'.'
+
'1.1'
+
'
\n
'
+
' '
+
' '
+
'^'
+
'
\n
'
+
bold
(
red
(
'SyntaxError'
))
+
': '
+
cyan
(
'invalid syntax'
)
+
'
\n
'
self
.
assertEquals
(
str
(
plain
(
''
).
join
(
a
)),
str
(
expected
))
self
.
assertEquals
(
plain
(
''
).
join
(
a
),
expected
)
def
test_traceback
(
self
):
i
=
interpreter
.
Interp
()
a
=
[]
def
append_to_a
(
message
):
a
.
append
(
message
)
i
.
write
=
append_to_a
def
f
():
return
1
/
0
def
g
():
return
f
()
i
.
runsource
(
'g()'
)
expected
=
'Traceback (most recent call last):
\n
'
+
''
+
' File '
+
green
(
'"<input>"'
)
+
', line '
+
bold
(
magenta
(
'1'
))
+
', in '
+
cyan
(
'<module>'
)
+
'
\n
'
+
''
+
bold
(
red
(
'NameError'
))
+
': '
+
cyan
(
u"name 'g' is not defined"
)
+
'
\n
'
self
.
assertEquals
(
str
(
plain
(
''
).
join
(
a
)),
str
(
expected
))
self
.
assertEquals
(
plain
(
''
).
join
(
a
),
expected
)
class
TestPreprocessing
(
unittest
.
TestCase
):
def
test_bad_empty_lines_removed
(
self
):
self
.
assertEqual
(
bad_empty_lines_removed
(
"def foo():
\n
"
" return 1
\n
"
"
\n
"
" pass
\n
"
),
"def foo():
\n
"
" return 1
\n
"
" pass
\n
"
)
Back
|
FazBrowse Home
|
New Git URL