Skip to content

Commit

Permalink
Make formats parameter in Image.open accept aNy cAsE
Browse files Browse the repository at this point in the history
  • Loading branch information
Piolie committed Feb 5, 2021
1 parent 023dbe3 commit 0c1675a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_open_formats(self):
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)

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ def _open_core(fp, filename, prefix, formats):
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)
Expand Down

0 comments on commit 0c1675a

Please sign in to comment.