FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-progressbar/tests/test_widgets.py at develop · reuben/python-progressbar · GitHub
reuben
/
python-progressbar
Public
forked from
wolph/python-progressbar
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-progressbar
/
tests
/
test_widgets.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
117 lines (103 loc) · 3.28 KB
Breadcrumbs
python-progressbar
/
tests
/
test_widgets.py
Copy path
File metadata and controls
117 lines (103 loc) · 3.28 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import
time
import
pytest
import
progressbar
max_values
=
[
None
,
10
,
progressbar
.
UnknownLength
]
def
test_widgets_small_values
():
widgets
=
[
'Test: '
,
progressbar
.
Percentage
(),
' '
,
progressbar
.
Bar
(
marker
=
progressbar
.
RotatingMarker
()),
' '
,
progressbar
.
ETA
(),
' '
,
progressbar
.
AbsoluteETA
(),
' '
,
progressbar
.
FileTransferSpeed
(),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
10
).
start
()
p
.
update
(
0
)
for
i
in
range
(
10
):
time
.
sleep
(
1
)
p
.
update
(
i
+
1
)
p
.
finish
()
@
pytest
.
mark
.
parametrize
(
'max_value'
, [
10
**
6
,
10
**
8
])
def
test_widgets_large_values
(
max_value
):
widgets
=
[
'Test: '
,
progressbar
.
Percentage
(),
' '
,
progressbar
.
Bar
(
marker
=
progressbar
.
RotatingMarker
()),
' '
,
progressbar
.
ETA
(),
' '
,
progressbar
.
AbsoluteETA
(),
' '
,
progressbar
.
FileTransferSpeed
(),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
max_value
).
start
()
for
i
in
range
(
0
,
10
**
6
,
10
**
4
):
time
.
sleep
(
1
)
p
.
update
(
i
+
1
)
p
.
finish
()
def
test_format_widget
():
widgets
=
[]
for
mapping
in
progressbar
.
FormatLabel
.
mapping
:
widgets
.
append
(
progressbar
.
FormatLabel
(
'%%(%s)r'
%
mapping
))
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
)
for
i
in
p
(
range
(
10
)):
time
.
sleep
(
1
)
@
pytest
.
mark
.
parametrize
(
'max_value'
, [
None
,
10
])
def
test_all_widgets_small_values
(
max_value
):
widgets
=
[
progressbar
.
Timer
(),
progressbar
.
ETA
(),
progressbar
.
AdaptiveETA
(),
progressbar
.
AbsoluteETA
(),
progressbar
.
DataSize
(),
progressbar
.
FileTransferSpeed
(),
progressbar
.
AdaptiveTransferSpeed
(),
progressbar
.
AnimatedMarker
(),
progressbar
.
Counter
(),
progressbar
.
Percentage
(),
progressbar
.
FormatLabel
(
'%(value)d'
),
progressbar
.
SimpleProgress
(),
progressbar
.
Bar
(),
progressbar
.
ReverseBar
(),
progressbar
.
BouncingBar
(),
progressbar
.
CurrentTime
(),
progressbar
.
CurrentTime
(
microseconds
=
False
),
progressbar
.
CurrentTime
(
microseconds
=
True
),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
max_value
)
for
i
in
range
(
10
):
time
.
sleep
(
1
)
p
.
update
(
i
+
1
)
p
.
finish
()
@
pytest
.
mark
.
parametrize
(
'max_value'
, [
10
**
6
,
10
**
7
])
def
test_all_widgets_large_values
(
max_value
):
widgets
=
[
progressbar
.
Timer
(),
progressbar
.
ETA
(),
progressbar
.
AdaptiveETA
(),
progressbar
.
AbsoluteETA
(),
progressbar
.
DataSize
(),
progressbar
.
FileTransferSpeed
(),
progressbar
.
AdaptiveTransferSpeed
(),
progressbar
.
AnimatedMarker
(),
progressbar
.
Counter
(),
progressbar
.
Percentage
(),
progressbar
.
FormatLabel
(
'%(value)d/%(max_value)d'
),
progressbar
.
SimpleProgress
(),
progressbar
.
Bar
(
fill
=
lambda
progress
,
data
,
width
:
'#'
),
progressbar
.
ReverseBar
(),
progressbar
.
BouncingBar
(),
progressbar
.
FormatCustomText
(
'Custom %(text)s'
,
dict
(
text
=
'text'
)),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
max_value
)
p
.
update
()
time
.
sleep
(
1
)
p
.
update
()
for
i
in
range
(
0
,
10
**
6
,
10
**
4
):
time
.
sleep
(
1
)
p
.
update
(
i
)
Back
|
FazBrowse Home
|
New Git URL