def test_get_estimated_size(self):
        image = ImageModelFactory.create()
        thumbnail = Thumbnail(image.file.path, {'size': ['50', '50']})

        size = thumbnail.get_estimated_size()
        assert size.width == 25
        assert size.height == 50

        # Test property
        assert thumbnail.size == size
    def test_get_estimated_size(self):
        image = ImageModelFactory.create()
        thumbnail = Thumbnail(image.file.path, {'size': ['50', '50']})

        size = thumbnail.get_estimated_size()
        assert size.width == 25
        assert size.height == 50

        # Test property
        assert thumbnail.size == size
    def test_estimated_size(self, input_size, thumb_size, upscale, crop,
                            expected):
        image = ImageModelFactory.create(file__width=input_size[0],
                                         file__height=input_size[1])

        instance = Thumbnail(
            image.file.path,
            {
                'size': (str(thumb_size[0]), str(thumb_size[1])),
                'upscale': upscale,
                'crop': crop,
            },
        )
        assert instance.get_estimated_size() == Size(
            *expected), '{0} -> {1} (upscale: {3} crop: {2})'.format(
                input_size, thumb_size, crop, upscale)
    def test_estimated_size(self, input_size, thumb_size, upscale, crop, expected):
        image = ImageModelFactory.create(
            file__width=input_size[0], file__height=input_size[1])

        instance = Thumbnail(image.file.path, {
            'size': (str(thumb_size[0]), str(thumb_size[1])),
            'upscale': upscale,
            'crop': crop
        })
        assert instance.get_estimated_size() == Size(*expected), (
            '{0} -> {1} (upscale: {3} crop: {2})'.format(
                input_size,
                thumb_size,
                crop,
                upscale
            ))