-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_app.py
47 lines (40 loc) · 1.25 KB
/
test_app.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
import pytest
from app import enrich_with_delta
def test_enrich_with_delta():
previous_record = {
"Delta (timeIntroSkipping)": 0,
"Delta (timeListened)": 0,
"Delta (timeSilenceRemoval)": 0,
"Delta (timeSkipping)": 0,
"Delta (timeVariableSpeed)": 0,
"timeIntroSkipping": 17420,
"timeListened": 3446030,
"timeSilenceRemoval": 352305,
"timeSkipping": 32533,
"timeVariableSpeed": 2784949,
}
current_record = {
"timeIntroSkipping": 17425,
"timeListened": 3446040,
"timeSilenceRemoval": 352335,
"timeSkipping": 32583,
"timeVariableSpeed": 2784969,
}
expected_record = {
"Delta (timeIntroSkipping)": 5,
"Delta (timeListened)": 10,
"Delta (timeSilenceRemoval)": 30,
"Delta (timeSkipping)": 50,
"Delta (timeVariableSpeed)": 20,
"timeIntroSkipping": 17425,
"timeListened": 3446040,
"timeSilenceRemoval": 352335,
"timeSkipping": 32583,
"timeVariableSpeed": 2784969,
}
assert (
enrich_with_delta(current_record, previous_record) == expected_record
)
assert (
enrich_with_delta(current_record, previous_record) != previous_record
)