tests.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:munch-core 作者: crunchmail 项目源码 文件源码
def test_image_resizing(self):
        image = Image(organization=self.organization)
        file = ContentFile(self.create_random_image(100, 100).read())

        image.file.save('random_image.png', file, save=False)
        image.save()

        image_file = PIL.Image.open(image.file.file)
        self.assertEqual((100, 100), image_file.size)

        image = Image(organization=self.organization)
        file = ContentFile(self.create_random_image(100, 100).read())

        image.file.save('random_image.png', file, save=False)
        image.width = 50
        image.save()

        image_file = PIL.Image.open(image.file.file)
        self.assertEqual((50, 50), image_file.size)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号