mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-03 03:50:09 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
a12389bf35
commit
2f6467c94e
|
@ -23,6 +23,7 @@ def test_sanity():
|
|||
def test_large_file_is_truncated():
|
||||
import warnings
|
||||
from unittest.mock import patch
|
||||
|
||||
try:
|
||||
original_value = GimpPaletteFile._max_file_size
|
||||
GimpPaletteFile._max_file_size = 100
|
||||
|
@ -35,6 +36,7 @@ def test_large_file_is_truncated():
|
|||
finally:
|
||||
GimpPaletteFile._max_file_size = original_value
|
||||
|
||||
|
||||
def test_get_palette():
|
||||
# Arrange
|
||||
with open("Tests/images/custom_gimp_palette.gpl", "rb") as fp:
|
||||
|
|
|
@ -28,7 +28,7 @@ class GimpPaletteFile:
|
|||
#: override if reading larger palettes is needed
|
||||
max_colors = 256
|
||||
_max_line_size = 100
|
||||
_max_file_size = 2 ** 20
|
||||
_max_file_size = 2**20
|
||||
|
||||
def __init__(self, fp):
|
||||
|
||||
|
@ -47,7 +47,8 @@ class GimpPaletteFile:
|
|||
read += len(s)
|
||||
if read >= self._max_file_size:
|
||||
warnings.warn(
|
||||
f"Palette file truncated at {self._max_file_size - len(s)} bytes")
|
||||
f"Palette file truncated at {self._max_file_size - len(s)} bytes"
|
||||
)
|
||||
break
|
||||
|
||||
# skip fields and comment lines
|
||||
|
|
Loading…
Reference in New Issue
Block a user