From cc2089795f03b1483aea5e7611b21d106754b4a0 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sat, 11 May 2019 01:22:55 +0200 Subject: Add previously forgotten test --- tests/test_blurhash.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_blurhash.py (limited to 'tests') 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 @@ +import pytest + +def test_blurhash_decode(api): + fake_media_dict = { + 'width': 320, + 'height': 240, + 'blurhash': '=~NdOWof1PbIPUXSvgbI$f' + } + decoded_image = api.decode_blurhash(fake_media_dict) + assert len(decoded_image) == 9 * 16 + assert len(decoded_image[0]) == 16 + + decoded_image_2 = api.decode_blurhash( + fake_media_dict, + out_size = (fake_media_dict["width"], fake_media_dict["height"]), + size_per_component = False, + return_linear = False + ) + assert len(decoded_image_2) == 240 + assert len(decoded_image_2[0]) == 320 + -- cgit v1.2.3