-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_main.py
196 lines (164 loc) · 21.9 KB
/
test_main.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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import iscc_sdk as idk
def test_code_iscc_text(pdf_file):
assert idk.code_iscc(pdf_file).dict() == {
"@type": "TextDigitalDocument",
"characters": 16995,
"datahash": "1e207ad5c7dbf6a6538f15fd0439e0dc5ba03a043ea23f072aa4e2ba830811bdb5f0",
"filename": "text.pdf",
"filesize": 188280,
"iscc": "ISCC:KACV5NAQXBCHCWFWMNALVJHBLB7X7IFU4H2JIVUSWF5NLR6362TFHDY",
"mediatype": "application/pdf",
"metahash": "1e201da548c5285ed35f293c3e22c2f050e037643aae8cf9244b532a162ff5031f52",
"mode": "text",
"name": "title from metadata",
"thumbnail": "data:image/webp;base64,UklGRhQEAABXRUJQVlA4IAgEAACwEgCdASpjAIAAPrVSo02nJKMiJ3O6yOAWiWkzjSC1C6Reznp+sQABFkPaZh/aCmUqsW/BvosW2KfVw78WmUc08wM8nb3c11VnfyGy2a5aPdfxHCQTwGxGweNMGzxm2Z2jEFxvqwoATFlrf9xo/VE9udn1Q64BAxos65LBrtLozEg6mat+LakDTH4PFrwm0iNqiFpj+d5x/j78PkCBoAD+mzFNArdTvG0MlL8f5xH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qUIuGey8GNAakDAw+3twOnba3UVHgWM86HBqe68HxzBZZ6ykNwsz64ABCV5zgAAA=",
}
def test_code_iscc_image(jpg_file):
assert idk.code_iscc(jpg_file).dict() == {
"@type": "ImageObject",
"iscc": "ISCC:KECWRY3VY6R5SNV4YNBTBHR4T2HGP3HKVFO7TYUP2BKVFG724W63HVI",
"creator": "Some Cat Lover",
"datahash": "1e2055529bfae5bdb3d530c52f44d13ccd6a7c710f63620dc2db1c43c5592ae2dc97",
"filesize": 35393,
"filename": "img.jpg",
"height": 133,
"mediatype": "image/jpeg",
"metahash": "1e209ce5052a03004657d8657167f53812718e9426d85b4cdd5106ef3d87412e6f64",
"mode": "image",
"name": "Concentrated Cat",
"thumbnail": "data:image/webp;base64,UklGRvAHAABXRUJQVlA4IOQHAABQJQCdASqAAFUAPrVMnkunJCKhrVjKkOAWiWcAy+b1fnJDL7KtR11yfpurVtqQv0h9En1z7BSqqigVxVyQJWYLSDs4owmw56DqM1t/tasEGie6aFYeivDr7HgzCNgzhxzPgarojoLwNzZNA5ZPdHtj1roXiaRBe7fSWxi1uA02u9uNMxRCnn+N264Q61rOkzdTuxc6a7HC2q2DxyC2nr5NDuSAZTmGxi93cN++LmTu/oHNsCWEcx0WoqK3hWheFStQU177Gkzt7OVFyfZBuW8pD27b42ydJINbQSHgjh5P9GMitV15X+D0Vop1yuIR7oWkfndZCDj8yk21ku+Tzy9NEhTc6anv3mRBQjQiJoSRJKMzH4x8HYEIcVTr100dHBIduMhC1EBdIA1S0BTSB5xbUX4AAP7+SeEIYFJfV+xP62VI3ExsgyeFQT9u81Bi1JP9eapJYp70eu8AN/Nz897ilDGGp7XpcD+OM27RXX2CBqWKNTOQi6/wURlIDSIQK2dKSRZ2BQCfKaNDum1SXASbjmE+sN7QnZK0uS91/gSGiF6DBw5rPD0Auor/KY1+zESetqPdZtKjYCjYYRoIwd5Q9siPynx7nYcKIZpXvi/0W64pObvUEXbkmxuZYeuxxx2Cbxbfb2nsi9HuNk6XOs0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9Aq5gt68mGxSylf7+G5Gm4suhC7iSqEdmLeuWCymk6S2jz39uqOtReEbWIiTWf61n7IAoZL3vfnMC9ickbJQB/B6Fw+5p258HYBHx4D5z+51lR5D22+BosAqXfVjmI9sgcgtr4Am2ZJEF07mN9qk0F6BXe5UEWIiRuKxQu+vSQMiZx8BG452sVWkVw8dxnu9qree0U0XyiBfWsKN80iYFUgCTVKMeC8uqk/3E4RPhVutO2OgOAwm+OYr5tSsE7flYCN+ipzjuOsXOpqhBj//4brOSasoa9Ds0jSrKtOT8YFKsa1phuls8CvrR64ZKP/Kp0AGGFbigPsr8pk2ce2Y++gl6dO7cBfewq/z9/g3fD7Y5ybAW7MS7ai8PZkn+N6kqnz/TAkT/NLNq/MJion0CbtmWy87BQaWf6gAgfTqin8ziJsLoPxXdKrYXDFVm68+muxi0rR2DDKt5TJNrXd9sAtX4cv6HjPoeFhWUEzknwB0SojSpZLC8KPe1JAeM0zg8gaI/R+ThBRxLw7fH1wt+vSP+4Ru4FjDRyx87nymy3KWL1ccOy8/lsdxkphMF9Uf/OlMaF7R417Mt3oMOJhE0gqKMnA0z+Wi7PwRTIWtiyAcAGwR7w/Z5ryERIk9/CcmJdsTaeaXrcELsHFdqEr7ATVnQtKn8um8Ypiv9veazp3dH+HGD9FG/iYlHuzNMDojxZ0T4fH0pWlhqf/Nd0XCCgijVwEgwHPqArHS93U9RDzguCYXU9qhQEC8jy902FCvrR8TMX84+gilkkizMAR0TcCo7IxHO1YG3D2lYq1BA4WxekrFYnj/5hMAsaHymnqwDPPlX46x3Xy5rHuPadXFaAxJNAf7NeM5WWcM9MCs3BOpXUVIqfr+x9Igy/FehT0vBRAhNP+u6v9LEZRqfbxADwwWRSEk6Io4VSGX5LpRVqMLCG+eYAAA",
"width": 200,
}
def test_code_iscc_audio(mp3_file):
assert idk.code_iscc(mp3_file).dict() == {
"@type": "AudioObject",
"iscc": "ISCC:KIC2JKSX7OH5PBIENISKEJTS4TRKHYJBCZDNLQXYILWJHQAP3N3KPTQ",
"name": "Belly Button",
"datahash": "1e20ec93c00fdb76a7cec587e4a2bddfa8d0a0bac8110d0c7130c351ea07c366d626",
"duration": 15,
"filesize": 225707,
"filename": "audio.mp3",
"mediatype": "audio/mpeg",
"metahash": "1e20c4933dc8c03ea58568159a1cbfb04132c7db93b6b4cd025ffd4db37f52a4756f",
"mode": "audio",
}
def test_code_iscc_video(mp4_file):
assert idk.code_iscc(mp4_file).dict() == {
"@type": "VideoObject",
"datahash": "1e209d412d76d9d516d07bb60f1ab3c1a5c1b176ed4f1cec94c96222a5d013ec3e38",
"filename": "video.mp4",
"filesize": 2161914,
"iscc": "ISCC:KMCV6UK6BSXJ3I4GLYHIH5A5DNZPYBWQO33FNHPQFOOUCLLW3HKRNUA",
"mediatype": "video/mp4",
"metahash": "1e2096c0a53475a186ce37622aba7ba70651fc62cc8150f59eee6d17dc16d9bfbf25",
"mode": "video",
"name": "Kali by Anokato - Spiral Sessions 2019",
"thumbnail": "data:image/webp;base64,UklGRkAFAABXRUJQVlA4IDQFAABQHACdASqAAGkAPrVUoU0nJL+iJds7o/AWiUAaVUmMC9Ymbvi4gI54bTdt50rwr7N+M3nP42/ab9zzG+k74b8n/VrvT9OHkr3QnKPB0+k/qr4qX8d6D/UjzQ/9N6a94N4t7AH8n/u3/R9lT+k8bP0p7Af66dcEw8O/Fjh0V9q/EzGIXOPxxGpc24WPN9p12h+zeDRpntIPLKARwz62m3BPGyFS9rzZiv3VJlg+hNKMMfZMQJzHYwM5pXOu/B8cvvwU0x4TrPQT/1NWb1QiI/XoZOGjVrAntgus6zRf5zFWbUxamLYiInReOWnQAP750EAB6/Gz7ppI6A3w/zt8U/tR4HwZILZiEJ39oTo6Jf1u3N4w7w0ALWz10zrZ8GVMOcoN7ib8ZG9jZz1xUfcW9Sdg0+9vgh5GLQpOT77rQTmy2vkPAmUpMeQOnCAYqmD8In78khGhd2PPfNzF5wjbMmcxmZr8pk0Tzza+jvY6twcoqfijYdYqRMT6BRQl95E1TQJ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lAZe290TV0R2vYx51znfnph4aLw6OiksjFM//JnYh/JEMYlTjl/v4LCa8qFgHQ/yPJql1BtdwmM9g3NkoL50nf/cOlQmSwljeE33QqAp0NwgkAlo7c3/LEib8gvzr+CHETvA4pAL1yMJfLDfxlG5U/+AeRF6lDsnZfKTDeUeZwAAAAAAA=",
}
def test_code_meta_image(jpg_file):
assert idk.code_meta(jpg_file).dict() == {
"iscc": "ISCC:AAAWRY3VY6R5SNV4",
"name": "Concentrated Cat",
"creator": "Some Cat Lover",
"width": 200,
"height": 133,
"metahash": "1e209ce5052a03004657d8657167f53812718e9426d85b4cdd5106ef3d87412e6f64",
}
def test_code_meta_audio(mp3_file):
assert idk.code_meta(mp3_file).dict() == {
"iscc": "ISCC:AAA2JKSX7OH5PBIE",
"name": "Belly Button",
"duration": 15,
"metahash": "1e20c4933dc8c03ea58568159a1cbfb04132c7db93b6b4cd025ffd4db37f52a4756f",
}
def test_code_meta_video(mp4_file):
assert idk.code_meta(mp4_file).dict() == {
"iscc": "ISCC:AAAV6UK6BSXJ3I4G",
"name": "Kali by Anokato - Spiral Sessions 2019",
"metahash": "1e2096c0a53475a186ce37622aba7ba70651fc62cc8150f59eee6d17dc16d9bfbf25",
}
def test_code_meta_image_no_meta(bmp_file):
assert idk.code_meta(bmp_file).dict() == {
"iscc": "ISCC:AAA374FA7VF3FWZQ",
"name": "img",
"width": 200,
"height": 133,
"metahash": "1e20bff0a0fd4bb2db301741c4c9cbfced1085e2051e6009edb12b004330fa7f5111",
}
def test_code_content(jpg_file):
assert idk.code_content(jpg_file).dict() == {
"@type": "ImageObject",
"creator": "Some Cat Lover",
"height": 133,
"iscc": "ISCC:EEA4GQZQTY6J5DTH",
"mediatype": "image/jpeg",
"mode": "image",
"name": "Concentrated Cat",
"thumbnail": "data:image/webp;base64,UklGRvAHAABXRUJQVlA4IOQHAABQJQCdASqAAFUAPrVMnkunJCKhrVjKkOAWiWcAy+b1fnJDL7KtR11yfpurVtqQv0h9En1z7BSqqigV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M0zg8gaI/R+ThBRxLw7fH1wt+vSP+4Ru4FjDRyx87nymy3KWL1ccOy8/lsdxkphMF9Uf/OlMaF7R417Mt3oMOJhE0gqKMnA0z+Wi7PwRTIWtiyAcAGwR7w/Z5ryERIk9/CcmJdsTaeaXrcELsHFdqEr7ATVnQtKn8um8Ypiv9veazp3dH+HGD9FG/iYlHuzNMDojxZ0T4fH0pWlhqf/Nd0XCCgijVwEgwHPqArHS93U9RDzguCYXU9qhQEC8jy902FCvrR8TMX84+gilkkizMAR0TcCo7IxHO1YG3D2lYq1BA4WxekrFYnj/5hMAsaHymnqwDPPlX46x3Xy5rHuPadXFaAxJNAf7NeM5WWcM9MCs3BOpXUVIqfr+x9Igy/FehT0vBRAhNP+u6v9LEZRqfbxADwwWRSEk6Io4VSGX5LpRVqMLCG+eYAAA",
"width": 200,
}
def test_code_text(docx_file):
assert idk.code_text(docx_file).dict() == {
"iscc": "ISCC:EAAQMBEYQF6457DP",
"name": "title from metadata",
"creator": "titusz",
"characters": 4951,
}
def test_code_text_granular(docx_file):
idk.sdk_opts.granular = True
assert idk.code_text(docx_file).dict() == {
"iscc": "ISCC:EAAQMBEYQF6457DP",
"name": "title from metadata",
"creator": "titusz",
"characters": 4951,
"features": [
{
"kind": "text",
"version": 0,
"features": ["BgSYgX3O_G8"],
"sizes": [6069],
}
],
}
idk.sdk_opts.granular = False
def test_code_image(jpg_file):
assert idk.code_image(jpg_file).dict() == {
"creator": "Some Cat Lover",
"height": 133,
"iscc": "ISCC:EEA4GQZQTY6J5DTH",
"name": "Concentrated Cat",
"thumbnail": "data:image/webp;base64,UklGRvAHAABXRUJQVlA4IOQHAABQJQCdASqAAFUAPrVMnkunJCKhrVjKkOAWiWcAy+b1fnJDL7KtR11yfpurVtqQv0h9En1z7BSqqigVxVyQJWYLSDs4owmw56DqM1t/tasEGie6aFYeivDr7HgzCNgzhxzPgarojoLwNzZNA5ZPdHtj1roXiaRBe7fSWxi1uA02u9uNMxRCnn+N264Q61rOkzd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WtiyAcAGwR7w/Z5ryERIk9/CcmJdsTaeaXrcELsHFdqEr7ATVnQtKn8um8Ypiv9veazp3dH+HGD9FG/iYlHuzNMDojxZ0T4fH0pWlhqf/Nd0XCCgijVwEgwHPqArHS93U9RDzguCYXU9qhQEC8jy902FCvrR8TMX84+gilkkizMAR0TcCo7IxHO1YG3D2lYq1BA4WxekrFYnj/5hMAsaHymnqwDPPlX46x3Xy5rHuPadXFaAxJNAf7NeM5WWcM9MCs3BOpXUVIqfr+x9Igy/FehT0vBRAhNP+u6v9LEZRqfbxADwwWRSEk6Io4VSGX5LpRVqMLCG+eYAAA",
"width": 200,
}
def test_code_video(mp4_file):
assert idk.code_video(mp4_file).dict() == {
"iscc": "ISCC:EMAV4DUD6QORW4X4",
"name": "Kali by Anokato - Spiral Sessions 2019",
"thumbnail": "data:image/webp;base64,UklGRkAFAABXRUJQVlA4IDQFAABQHACdASqAAGkAPrVUoU0nJL+iJds7o/AWiUAaVUmMC9Ymbvi4gI54bTdt50rwr7N+M3nP42/ab9zzG+k74b8n/VrvT9OHkr3QnKPB0+k/qr4qX8d6D/UjzQ/9N6a94N4t7AH8n/u3/R9lT+k8bP0p7Af66dcEw8O/Fjh0V9q/EzGIXOPxxGpc24WPN9p12h+zeDRpntIPLKARwz62m3BPGyFS9rzZiv3VJlg+hNKMMfZMQJzHYwM5pXOu/B8cvvwU0x4TrPQT/1NWb1QiI/XoZOGjVrAntgus6zRf5zFWbUxamLYiInReOWnQAP750EAB6/Gz7ppI6A3w/zt8U/tR4HwZILZiEJ39oTo6Jf1u3N4w7w0ALWz10zrZ8GVMOcoN7ib8ZG9jZz1xUfcW9Sdg0+9vgh5GLQpOT77rQTmy2vkPAmUpMeQOnCAYqmD8In78khGhd2PPfNzF5wjbMmcxmZr8pk0Tzza+jvY6twcoqfijYdYqRMT6BRQl95E1TQJ2vBWwn/5P406F/viJYID3/5Dl3LJlsmMlCDoIcd8zEtx+XLqcpUaER8pnGFbViIzy/0X3LvUkP9xlJ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L50nf/cOlQmSwljeE33QqAp0NwgkAlo7c3/LEib8gvzr+CHETvA4pAL1yMJfLDfxlG5U/+AeRF6lDsnZfKTDeUeZwAAAAAAA=",
}
def test_code_data(png_file):
assert idk.code_data(png_file) == {"iscc": "ISCC:GAAXUI3LCN7D7VDE"}
def test_code_instance(png_file):
assert idk.code_instance(png_file).dict() == {
"datahash": "1e20feb85f1709f51ebf31c2feab2092a61826da36cc79eddc4cb04800b47db146a6",
"filesize": 54595,
"iscc": "ISCC:IAA75OC7C4E7KHV7",
}
def test_code_iscc_non_uri_metadata(jpg_file):
new_file = idk.image_meta_embed(jpg_file, idk.IsccMeta.construct(license="Hello World"))
assert idk.code_iscc(new_file).dict() == {
"@type": "ImageObject",
"creator": "Some Cat Lover",
"datahash": "1e2010f846e2a950469a4b0e310accd76574e019faa858805ba4f6543498623e53ed",
"filename": "img.jpg",
"filesize": 35426,
"height": 133,
"iscc": "ISCC:KECWRY3VY6R5SNV4YNBTBHR4T2HGP3MLVE44D2E72AIPQRXCVFIENGQ",
"license": "Hello World",
"mediatype": "image/jpeg",
"metahash": "1e209ce5052a03004657d8657167f53812718e9426d85b4cdd5106ef3d87412e6f64",
"mode": "image",
"name": "Concentrated Cat",
"thumbnail": "data:image/webp;base64,UklGRvAHAABXRUJQVlA4IOQHAABQJQCdASqAAFUAPrVMnkunJCKhrVjKkOAWiWcAy+b1fnJDL7KtR11yfpurVtqQv0h9En1z7BSqqigVxVyQJWYLSDs4owmw56DqM1t/tasEGie6aFYeivDr7HgzCNgzhxzPgarojoLwNzZNA5ZPdHtj1roXiaRBe7fSWxi1uA02u9uNMxRCnn+N264Q61rOkzdTuxc6a7HC2q2DxyC2nr5NDuSAZTmGxi93cN++LmTu/oHNsCWEcx0WoqK3hWheFStQU177Gkzt7OVFyfZBuW8pD27b42ydJINbQSHgjh5P9GMitV15X+D0Vop1yuIR7oWkfndZCDj8yk21ku+Tzy9NEhTc6anv3mRBQjQiJoSRJKMzH4x8HYEIcVTr100dH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