Make formats parameter in Image.open accept aNy cAsE

This commit is contained in:
Piolie 2021-02-04 22:47:53 -03:00
parent 023dbe3925
commit 0c1675a143
2 changed files with 2 additions and 2 deletions

View File

@ -94,7 +94,7 @@ class TestImage:
with pytest.raises(TypeError):
Image.open(PNGFILE, formats=123)
for formats in [["JPEG"], ("JPEG",)]:
for formats in [["jPeG"], ("JpEg",)]:
with pytest.raises(UnidentifiedImageError):
Image.open(PNGFILE, formats=formats)

View File

@ -2925,7 +2925,7 @@ def open(fp, mode="r", formats=None):
if i not in OPEN:
init()
try:
factory, accept = OPEN[i]
factory, accept = OPEN[i.upper()]
result = not accept or accept(prefix)
if type(result) in [str, bytes]:
accept_warnings.append(result)