Beispiel #1
0
def test_tinypng_compress():
    with success_result():
        compressed = shrink('<image bytes>', apikey='12345')
        assert compressed.success == True
        assert compressed.failure == False
        assert compressed.input_size == 100
        assert compressed.output_size == 50
        assert compressed.output_ratio == 2
        assert compressed.bytes == '<compressed image bytes>'
        assert compressed.errno == None
Beispiel #2
0
def test_tinypng_compress_error():
    with failure():
        compressed = shrink('<image bytes>', apikey='12345')
        assert compressed.failure == True
        assert compressed.errno == TinyPNGError.TooManyRequests
        assert compressed.bytes == None