FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
curtsies/tests/test_window.py at main · bpython/curtsies · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
bpython
/
curtsies
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
51
Star
231
Code
Issues
36
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
curtsies
/
tests
/
test_window.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (44 loc) · 1.7 KB
Breadcrumbs
curtsies
/
tests
/
test_window.py
Copy path
File metadata and controls
56 lines (44 loc) · 1.7 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
55
56
import
unittest
import
sys
from
curtsies
.
window
import
BaseWindow
,
FullscreenWindow
,
CursorAwareWindow
from
io
import
StringIO
from
unittest
import
skipIf
fds_closed
=
not
sys
.
stdin
.
isatty
()
or
not
sys
.
stdout
.
isatty
()
class
FakeFullscreenWindow
(
FullscreenWindow
):
width
=
property
(
lambda
self
:
10
)
height
=
property
(
lambda
self
:
4
)
@
skipIf
(
fds_closed
,
"blessed Terminal needs streams open"
)
class
TestBaseWindow
(
unittest
.
TestCase
):
"""Pretty pathetic tests for window"""
def
test_window
(
self
):
fakestdout
=
StringIO
()
window
=
BaseWindow
(
fakestdout
)
window
.
write
(
"hi"
)
fakestdout
.
seek
(
0
)
self
.
assertEqual
(
fakestdout
.
read
(),
"hi"
)
def
test_array_from_text
(
self
):
window
=
BaseWindow
()
a
=
window
.
array_from_text
(
".
\n
.
\n
."
)
self
.
assertEqual
(
a
.
height
,
3
)
self
.
assertEqual
(
a
[
0
],
"."
)
self
.
assertEqual
(
a
[
1
],
"."
)
def
test_array_from_text_rc
(
self
):
a
=
BaseWindow
.
array_from_text_rc
(
"asdfe
\n
zx
\n
\n
123"
,
3
,
4
)
self
.
assertEqual
(
a
.
height
,
3
)
self
.
assertEqual
(
a
.
width
,
4
)
self
.
assertEqual
(
a
[
0
],
"asdf"
)
self
.
assertEqual
(
a
[
1
],
"e"
)
self
.
assertEqual
(
a
[
2
],
"zx"
)
def
test_fullscreen_window
(
self
):
fakestdout
=
StringIO
()
window
=
FullscreenWindow
(
fakestdout
)
window
.
write
(
"hi"
)
fakestdout
.
seek
(
0
)
self
.
assertEqual
(
fakestdout
.
read
(),
"hi"
)
def
test_fullscreen_render_to_terminal
(
self
):
fakestdout
=
StringIO
()
window
=
FakeFullscreenWindow
(
fakestdout
)
window
.
render_to_terminal
([
"hello"
,
"hello"
,
"hello"
])
fakestdout
.
seek
(
0
)
output
=
fakestdout
.
read
()
self
.
assertEqual
(
output
.
count
(
"hello"
),
3
)
Back
|
FazBrowse Home
|
New Git URL