[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2022-10-06 16:51:28 +00:00
parent a12389bf35
commit 2f6467c94e
2 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,7 @@ def test_sanity():
def test_large_file_is_truncated(): def test_large_file_is_truncated():
import warnings import warnings
from unittest.mock import patch from unittest.mock import patch
try: try:
original_value = GimpPaletteFile._max_file_size original_value = GimpPaletteFile._max_file_size
GimpPaletteFile._max_file_size = 100 GimpPaletteFile._max_file_size = 100
@ -35,6 +36,7 @@ def test_large_file_is_truncated():
finally: finally:
GimpPaletteFile._max_file_size = original_value GimpPaletteFile._max_file_size = original_value
def test_get_palette(): def test_get_palette():
# Arrange # Arrange
with open("Tests/images/custom_gimp_palette.gpl", "rb") as fp: with open("Tests/images/custom_gimp_palette.gpl", "rb") as fp:

View File

@ -47,7 +47,8 @@ class GimpPaletteFile:
read += len(s) read += len(s)
if read >= self._max_file_size: if read >= self._max_file_size:
warnings.warn( 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 break
# skip fields and comment lines # skip fields and comment lines