mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Convert large_memory_numpy_test.py to use unittest (and change second XDIM on line 36 to YDIM)
This commit is contained in:
parent
c6386a294d
commit
cf07aa60a1
|
@ -1,4 +1,4 @@
|
|||
from tester import *
|
||||
from helper import *
|
||||
|
||||
# This test is not run automatically.
|
||||
#
|
||||
|
@ -6,32 +6,37 @@ from tester import *
|
|||
# second test. Running this automatically would amount to a denial of
|
||||
# service on our testing infrastructure. I expect this test to fail
|
||||
# on any 32 bit machine, as well as any smallish things (like
|
||||
# raspberrypis).
|
||||
# Raspberry Pis).
|
||||
|
||||
from PIL import Image
|
||||
try:
|
||||
import numpy as np
|
||||
except:
|
||||
skip()
|
||||
sys.exit("Skipping: Numpy not installed")
|
||||
|
||||
ydim = 32769
|
||||
xdim = 48000
|
||||
f = tempfile('temp.png')
|
||||
|
||||
def _write_png(xdim,ydim):
|
||||
dtype = np.uint8
|
||||
a = np.zeros((xdim, ydim), dtype=dtype)
|
||||
im = Image.fromarray(a, 'L')
|
||||
im.save(f)
|
||||
success()
|
||||
|
||||
def test_large():
|
||||
""" succeeded prepatch"""
|
||||
_write_png(xdim,ydim)
|
||||
def test_2gpx():
|
||||
"""failed prepatch"""
|
||||
_write_png(xdim,xdim)
|
||||
YDIM = 32769
|
||||
XDIM = 48000
|
||||
|
||||
|
||||
class LargeMemoryNumpyTest(PillowTestCase):
|
||||
|
||||
def _write_png(self, XDIM, YDIM):
|
||||
dtype = np.uint8
|
||||
a = np.zeros((XDIM, YDIM), dtype=dtype)
|
||||
f = self.tempfile('temp.png')
|
||||
im = Image.fromarray(a, 'L')
|
||||
im.save(f)
|
||||
|
||||
def test_large(self):
|
||||
""" succeeded prepatch"""
|
||||
self._write_png(XDIM, YDIM)
|
||||
|
||||
def test_2gpx(self):
|
||||
"""failed prepatch"""
|
||||
self._write_png(XDIM, YDIM)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
# End of file
|
||||
|
|
|
@ -14,7 +14,7 @@ YDIM = 32769
|
|||
XDIM = 48000
|
||||
|
||||
|
||||
class TestImage(PillowTestCase):
|
||||
class LargeMemoryTest(PillowTestCase):
|
||||
|
||||
def _write_png(self, XDIM, YDIM):
|
||||
f = self.tempfile('temp.png')
|
||||
|
@ -27,7 +27,7 @@ class TestImage(PillowTestCase):
|
|||
|
||||
def test_2gpx(self):
|
||||
"""failed prepatch"""
|
||||
self._write_png(XDIM, XDIM)
|
||||
self._write_png(XDIM, YDIM)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user