Esempio n. 1
0
 def get_width(self, instance):
     return calculate_thumbnail_size(instance.width, instance.height, 400)[0]
Esempio n. 2
0
def test_calculate_thumbnail_size():
    assert calculate_thumbnail_size(400, 800, 500) == (250, 500)
    assert calculate_thumbnail_size(3000, 800, 3000) == (3000, 800)
    assert calculate_thumbnail_size(None, None, 500) == (400, 300)
    assert calculate_thumbnail_size(None, None, None) == (400, 300)