-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_manual.py
executable file
·73 lines (56 loc) · 1.55 KB
/
test_manual.py
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
import sys
from time import sleep
from nano_profiler import NanoProfiler
def test_1():
n_p = NanoProfiler(name='Foo Bar Baz', autostart=True)
sleep(0.1)
n_p.mark('Foo')
sleep(0.125)
n_p.mark('Bar')
n_p.mark('Baz')
def test_2():
n_p = NanoProfiler(name='A long caption of my profiler with short comments', autostart=True)
sleep(0.25)
n_p.mark('T1')
sleep(0.01)
n_p.mark('T2')
sleep(0.35)
n_p.mark('T3')
def test_3():
n_p = NanoProfiler(name='my stat', autostart=True)
sleep(0.05)
n_p.mark('Test case with short caption ans long comments')
sleep(0.05)
n_p.mark('Execute function to prepare data')
sleep(0.05)
n_p.mark('Find a target value from a long life circle')
def test_4():
n_p = NanoProfiler(name='', autostart=True)
n_p._points[0]['time'] = 0
n_p._points.append({
'time': 10,
'label': 'Test case with big seconds'
})
n_p._points.append({
'time': 110,
'label': '100 seconds'
})
n_p._points.append({
'time': 1110,
'label': '1000 seconds'
})
n_p._points.append({
'time': 3600*24*7 + 1110,
'label': '*Ring* *Ring*, *breathe*, Seven days!'
})
def test_5():
n_p = NanoProfiler(name='Test case from real.', autostart=True)
n_p._points[0]['time'] = 0
n_p._points.append({
'time': 10,
'label': 'This was not surprise for me...'
})
# for run test_case 1 execute python3 test_manual.py 1
test_case = 'test_{}'.format(sys.argv[1])
func = locals()[test_case]
func()