Last active
August 29, 2015 14:05
-
-
Save marcosgabarda/901c99f5debdb75d47c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def random_image(size=(200, 200)): | |
""" Generates a random PIL image, for testings propouse. | |
:param size: Size of the random image generated. | |
""" | |
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255), 0) | |
return Image.new("RGBA", size, color) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StringIO | |
def test_picture_form(self): | |
"""Sample of test.""" | |
picture = random_image() | |
picture_file = StringIO.StringIO() | |
picture.save(picture_file, format="JPEG") | |
# Use picture for testing... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment