diff options
author | Lorenz Diener <[email protected]> | 2019-05-11 01:22:55 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-05-11 01:22:55 +0200 |
commit | cc2089795f03b1483aea5e7611b21d106754b4a0 (patch) | |
tree | 087c33ddf07635cb8d2eaa5fb6645fe6b986fbad /tests | |
parent | 721fe308ac0a16835dc0b48f7bc3072a38357442 (diff) | |
download | mastodon.py-cc2089795f03b1483aea5e7611b21d106754b4a0.tar.gz |
Add previously forgotten test
Diffstat (limited to 'tests')
-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 | |||