diff options
-rw-r--r-- | tests/test_blurhash.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_blurhash.py b/tests/test_blurhash.py new file mode 100644 index 0000000..3676f8f --- /dev/null +++ b/tests/test_blurhash.py | |||
@@ -0,0 +1,21 @@ | |||
1 | import pytest | ||
2 | |||
3 | def test_blurhash_decode(api): | ||
4 | fake_media_dict = { | ||
5 | 'width': 320, | ||
6 | 'height': 240, | ||
7 | 'blurhash': '=~NdOWof1PbIPUXSvgbI$f' | ||
8 | } | ||
9 | decoded_image = api.decode_blurhash(fake_media_dict) | ||
10 | assert len(decoded_image) == 9 * 16 | ||
11 | assert len(decoded_image[0]) == 16 | ||
12 | |||
13 | decoded_image_2 = api.decode_blurhash( | ||
14 | fake_media_dict, | ||
15 | out_size = (fake_media_dict["width"], fake_media_dict["height"]), | ||
16 | size_per_component = False, | ||
17 | return_linear = False | ||
18 | ) | ||
19 | assert len(decoded_image_2) == 240 | ||
20 | assert len(decoded_image_2[0]) == 320 | ||
21 | |||