def image_file(): image_file = BytesIO() image = Image.new("RGBA", size=(100, 100), color=(155, 0, 0)) image.save(image_file, "png") image_file.name = "test.png" image_file.url = "http://foo.com/test.png" image_file.seek(0) yield image_file
def _simple_png(): """Create a 1x1 black png in memory.""" image_file = BytesIO() image = Image.new('RGBA', (1, 1)) image.save(image_file, 'png') image_file.name = 'test.png' image_file.url = '{0}/{1}'.format(TEST_SERVER, image_file.name) image_file.seek(0) return image_file
def simple_png(): """Create a 1x1 black png in memory and return a handle to it.""" image_file = BytesIO() image = Image.new('RGBA', (1, 1)) image.save(image_file, 'png') image_file.name = 'test.png' image_file.url = 'http://testserver' + image_file.name image_file._committed = True image_file.seek(0) return image_file
def test_docstrings(self, urlopen): pretend_html = b"<!DOCTYPE HTML ...blah blah blah" responses.add("GET", "http://www.salesforce.com/", body=pretend_html) fake_http_stream = BytesIO(pretend_html) fake_http_stream.url = "https://www.salesforce.com/" urlopen.return_value = fake_http_stream try: doctest.testmod(fileutils, raise_on_error=True, verbose=True) except doctest.DocTestFailure as e: print("Got") print(str(e.got)) raise
def _simple_png(): """Create a 1x1 black png in memory.""" image_file = BytesIO() image = Image.new('RGBA', (1, 1)) image.save(image_file, 'png') image_file.name = 'test.png' image_file.url = '{0}/{1}'.format( TEST_SERVER, image_file.name ) image_file.seek(0) return image_file
def simple_png(): """Create a 1x1 black png in memory and return a handle to it.""" image_file = BytesIO() image = Image.new('RGBA', (1, 1)) image.save(image_file, 'png') image_file.name = 'test.png' image_file.url = '{0}/{1}'.format( TEST_SERVER, image_file.name, ) image_file._committed = True image_file.seek(0) return image_file