-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_code_content_video.py
66 lines (50 loc) · 2.06 KB
/
test_code_content_video.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
# -*- coding: utf-8 -*-
import iscc_core
def test_hash_video_v0_features():
assert (
iscc_core.code_content_video.soft_hash_video_v0([tuple([0] * 380)], bits=256)
== b"\x00" * 32
)
def test_hash_video_v0_range():
frame_vectors = [tuple(range(380))]
assert (
iscc_core.code_content_video.soft_hash_video_v0(frame_vectors, bits=256).hex()
== "528f91431f7c4ad26932fc073a28cac93f21a3071a152fc2925bdaed1d190061"
)
def test_hash_video_v0_multiple_framevectors():
fa = tuple([0, 1, 0, 2, 1] * 76)
fb = tuple([1, 2, 1, 0, 2] * 76)
frame_vectors = [fa, fb]
assert (
iscc_core.code_content_video.soft_hash_video_v0(frame_vectors, bits=256).hex()
== "9230d219501e00f42664b4bd206b000c98488635b0b03c010010ee00aaf93e43"
)
def test_code_video_v0_features():
assert iscc_core.code_content_video.gen_video_code_v0([tuple([0] * 380)]) == {
"iscc": "ISCC:EMAQAAAAAAAAAAAA"
}
def test_code_video_v0_range_128():
frame_vectors = [tuple(range(380))]
assert iscc_core.code_content_video.gen_video_code_v0(frame_vectors, bits=128) == {
"iscc": "ISCC:EMBVFD4RIMPXYSWSNEZPYBZ2FDFMS"
}
def test_code_video_v0_multiple_framevectors_256():
fa = tuple([0, 1, 0, 2, 1] * 76)
fb = tuple([1, 2, 1, 0, 2] * 76)
frame_vectors = [fa, fb]
assert iscc_core.code_content_video.gen_video_code_v0(frame_vectors, bits=256) == {
"iscc": "ISCC:EMDZEMGSDFIB4AHUEZSLJPJANMAAZGCIQY23BMB4AEABB3QAVL4T4QY"
}
def test_code_video_multiple_framevectors_256():
fa = tuple([0, 1, 0, 2, 1] * 76)
fb = tuple([1, 2, 1, 0, 2] * 76)
frame_vectors = [fa, fb]
assert iscc_core.code_content_video.gen_video_code(frame_vectors, bits=256) == {
"iscc": "ISCC:EMDZEMGSDFIB4AHUEZSLJPJANMAAZGCIQY23BMB4AEABB3QAVL4T4QY"
}
def test_gen_video_code_schema_confromance():
fa = tuple([0, 1, 0, 2, 1] * 76)
fb = tuple([1, 2, 1, 0, 2] * 76)
frame_vectors = [fa, fb]
iscc_obj = iscc_core.gen_video_code_v0(frame_vectors)
assert iscc_obj == {"iscc": "ISCC:EMAZEMGSDFIB4AHU"}