mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 18:03:07 +03:00
At least two spaces before inline comment
This commit is contained in:
parent
2202196162
commit
f22f1628eb
|
@ -246,7 +246,7 @@ class PillowLeakTestCase(PillowTestCase):
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
# man 2 getrusage:
|
# man 2 getrusage:
|
||||||
# ru_maxrss the maximum resident set size utilized (in bytes).
|
# ru_maxrss the maximum resident set size utilized (in bytes).
|
||||||
return mem / 1024 # Kb
|
return mem / 1024 # Kb
|
||||||
else:
|
else:
|
||||||
# linux
|
# linux
|
||||||
# man 2 getrusage
|
# man 2 getrusage
|
||||||
|
|
|
@ -581,7 +581,7 @@ class TestFileGif(PillowTestCase):
|
||||||
# see https://github.com/python-pillow/Pillow/issues/2811
|
# see https://github.com/python-pillow/Pillow/issues/2811
|
||||||
im = Image.open('Tests/images/issue_2811.gif')
|
im = Image.open('Tests/images/issue_2811.gif')
|
||||||
|
|
||||||
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
|
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
|
||||||
# codec error prepatch
|
# codec error prepatch
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ class TestFilePng(PillowTestCase):
|
||||||
@unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS")
|
@unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS")
|
||||||
class TestTruncatedPngPLeaks(PillowLeakTestCase):
|
class TestTruncatedPngPLeaks(PillowLeakTestCase):
|
||||||
mem_limit = 2*1024 # max increase in K
|
mem_limit = 2*1024 # max increase in K
|
||||||
iterations = 100 # Leak is 56k/iteration, this will leak 5.6megs
|
iterations = 100 # Leak is 56k/iteration, this will leak 5.6megs
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
if "zip_encoder" not in codecs or "zip_decoder" not in codecs:
|
if "zip_encoder" not in codecs or "zip_decoder" not in codecs:
|
||||||
|
|
|
@ -8,12 +8,12 @@ from PIL import Image, features, ImageDraw, ImageFont
|
||||||
class TestTTypeFontLeak(PillowLeakTestCase):
|
class TestTTypeFontLeak(PillowLeakTestCase):
|
||||||
# fails at iteration 3 in master
|
# fails at iteration 3 in master
|
||||||
iterations = 10
|
iterations = 10
|
||||||
mem_limit = 4096 #k
|
mem_limit = 4096 #k
|
||||||
|
|
||||||
def _test_font(self, font):
|
def _test_font(self, font):
|
||||||
im = Image.new('RGB', (255,255), 'white')
|
im = Image.new('RGB', (255,255), 'white')
|
||||||
draw = ImageDraw.ImageDraw(im)
|
draw = ImageDraw.ImageDraw(im)
|
||||||
self._test_leak(lambda: draw.text((0, 0), "some text "*1024, #~10k
|
self._test_leak(lambda: draw.text((0, 0), "some text "*1024, #~10k
|
||||||
font=font, fill="black"))
|
font=font, fill="black"))
|
||||||
|
|
||||||
@unittest.skipIf(not features.check('freetype2'), "Test requires freetype2")
|
@unittest.skipIf(not features.check('freetype2'), "Test requires freetype2")
|
||||||
|
@ -25,7 +25,7 @@ class TestTTypeFontLeak(PillowLeakTestCase):
|
||||||
class TestDefaultFontLeak(TestTTypeFontLeak):
|
class TestDefaultFontLeak(TestTTypeFontLeak):
|
||||||
# fails at iteration 37 in master
|
# fails at iteration 37 in master
|
||||||
iterations = 100
|
iterations = 100
|
||||||
mem_limit = 1024 #k
|
mem_limit = 1024 #k
|
||||||
|
|
||||||
def test_leak(self):
|
def test_leak(self):
|
||||||
default_font = ImageFont.load_default()
|
default_font = ImageFont.load_default()
|
||||||
|
|
|
@ -8,7 +8,7 @@ test_file = "Tests/images/hopper.webp"
|
||||||
@unittest.skipUnless(features.check('webp'), "WebP is not installed")
|
@unittest.skipUnless(features.check('webp'), "WebP is not installed")
|
||||||
class TestWebPLeaks(PillowLeakTestCase):
|
class TestWebPLeaks(PillowLeakTestCase):
|
||||||
|
|
||||||
mem_limit = 3 * 1024 # kb
|
mem_limit = 3 * 1024 # kb
|
||||||
iterations = 100
|
iterations = 100
|
||||||
|
|
||||||
def test_leak_load(self):
|
def test_leak_load(self):
|
||||||
|
|
|
@ -188,7 +188,7 @@ class ImageFile(Image.Image):
|
||||||
self.map = None
|
self.map = None
|
||||||
|
|
||||||
self.load_prepare()
|
self.load_prepare()
|
||||||
err_code = -3 # initialize to unknown error
|
err_code = -3 # initialize to unknown error
|
||||||
if not self.map:
|
if not self.map:
|
||||||
# sort tiles in file order
|
# sort tiles in file order
|
||||||
self.tile.sort(key=_tilesort)
|
self.tile.sort(key=_tilesort)
|
||||||
|
|
|
@ -572,7 +572,7 @@ class ImageFileDirectory_v2(collections.MutableMapping):
|
||||||
if ((info.length == 1) or
|
if ((info.length == 1) or
|
||||||
(info.length is None and len(values) == 1 and not legacy_api)):
|
(info.length is None and len(values) == 1 and not legacy_api)):
|
||||||
# Don't mess with the legacy api, since it's frozen.
|
# Don't mess with the legacy api, since it's frozen.
|
||||||
if legacy_api and self.tagtype[tag] in [5, 10]: # rationals
|
if legacy_api and self.tagtype[tag] in [5, 10]: # rationals
|
||||||
values = values,
|
values = values,
|
||||||
try:
|
try:
|
||||||
dest[tag], = values
|
dest[tag], = values
|
||||||
|
|
|
@ -193,8 +193,8 @@ TAGS_V2 = {
|
||||||
|
|
||||||
50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}),
|
50741: ("MakerNoteSafety", SHORT, 1, {"Unsafe": 0, "Safe": 1}),
|
||||||
50780: ("BestQualityScale", RATIONAL, 1),
|
50780: ("BestQualityScale", RATIONAL, 1),
|
||||||
50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one
|
50838: ("ImageJMetaDataByteCounts", LONG, 0), # Can be more than one
|
||||||
50839: ("ImageJMetaData", UNDEFINED, 1) # see Issue #2006
|
50839: ("ImageJMetaData", UNDEFINED, 1) # see Issue #2006
|
||||||
}
|
}
|
||||||
|
|
||||||
# Legacy Tags structure
|
# Legacy Tags structure
|
||||||
|
|
Loading…
Reference in New Issue
Block a user