forked from wolph/python-progressbar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimed.py
More file actions
90 lines (74 loc) · 2.03 KB
/
timed.py
File metadata and controls
90 lines (74 loc) · 2.03 KB
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
import time
import progressbar
def test_timer():
'''Testing (Adaptive)ETA when the value doesn't actually change'''
widgets = [
progressbar.Timer(),
]
p = progressbar.ProgressBar(max_value=2, widgets=widgets,
poll_interval=0.0001)
p.start()
p.update()
p.update(1)
p._needs_update()
time.sleep(0.001)
p.update(1)
p.finish()
def test_eta():
'''Testing (Adaptive)ETA when the value doesn't actually change'''
widgets = [
progressbar.ETA(),
]
p = progressbar.ProgressBar(min_value=0, max_value=2, widgets=widgets,
poll_interval=0.0001)
p.start()
time.sleep(0.001)
p.update(0)
time.sleep(0.001)
p.update(1)
time.sleep(0.001)
p.update(1)
time.sleep(0.001)
p.update(2)
time.sleep(0.001)
p.finish()
time.sleep(0.001)
p.update(2)
def test_adaptive_eta():
'''Testing (Adaptive)ETA when the value doesn't actually change'''
widgets = [
progressbar.AdaptiveETA(),
]
p = progressbar.ProgressBar(max_value=2, widgets=widgets,
poll_interval=0.0001)
p.start()
p.update(1)
time.sleep(0.001)
p.update(1)
p.finish()
def test_adaptive_transfer_speed():
'''Testing (Adaptive)ETA when the value doesn't actually change'''
widgets = [
progressbar.AdaptiveTransferSpeed(),
]
p = progressbar.ProgressBar(max_value=2, widgets=widgets,
poll_interval=0.0001)
p.start()
p.update(1)
time.sleep(0.001)
p.update(1)
p.finish()
def test_non_changing_eta():
'''Testing (Adaptive)ETA when the value doesn't actually change'''
widgets = [
progressbar.AdaptiveETA(),
progressbar.ETA(),
progressbar.AdaptiveTransferSpeed(),
]
p = progressbar.ProgressBar(max_value=2, widgets=widgets,
poll_interval=0.0001)
p.start()
p.update(1)
time.sleep(0.001)
p.update(1)
p.finish()