Beispiel #1
0
def test_should_call_resizetofit_when_crop_is_not_passed(my_mock):
    img = Image.new('RGB', (100, 100))
    Thumbnail(height=200, width=200, crop=False).process(img)
    assert_true(my_mock.called)
Beispiel #2
0
def test_should_call_resizetofill_when_crop_and_ancho_is_passed(my_mock):
    img = Image.new('RGB', (100, 100))
    Thumbnail(height=200, width=200, anchor='fake').process(img)
    assert_true(my_mock.called)
Beispiel #3
0
def test_should_repass_upscale_option_false(my_mock):
    img = Image.new('RGB', (100, 100))
    Thumbnail(height=200, width=200, upscale=False).process(img)
    my_mock.assert_called_once_with(width=200, upscale=False, height=200)
Beispiel #4
0
def test_should_raise_exception_when_crop_is_passed_without_height_and_width():
    img = Image.new('RGB', (100, 100))
    try:
        Thumbnail(crop=True).process(img)
    except Exception as e:
        eq_(str(e), 'You must provide both a width and height when cropping.')
Beispiel #5
0
def test_should_set_crop_to_true_if_anchor_is_passed_without_crop():
    thumb = Thumbnail(height=200, width=200, upscale=False, anchor='t')
    assert_true(thumb.crop)
Beispiel #6
0
def test_should_raise_exception_if_anchor_is_passed_and_crop_is_set_to_false():
    try:
        Thumbnail(height=200, width=200, upscale=False, crop=False, anchor='t')
    except Exception as e:
        eq_(str(e), "You can't specify an anchor point if crop is False.")