mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Make formats
parameter in Image.open
accept aNy cAsE
This commit is contained in:
parent
023dbe3925
commit
0c1675a143
|
@ -94,7 +94,7 @@ class TestImage:
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
Image.open(PNGFILE, formats=123)
|
Image.open(PNGFILE, formats=123)
|
||||||
|
|
||||||
for formats in [["JPEG"], ("JPEG",)]:
|
for formats in [["jPeG"], ("JpEg",)]:
|
||||||
with pytest.raises(UnidentifiedImageError):
|
with pytest.raises(UnidentifiedImageError):
|
||||||
Image.open(PNGFILE, formats=formats)
|
Image.open(PNGFILE, formats=formats)
|
||||||
|
|
||||||
|
|
|
@ -2925,7 +2925,7 @@ def open(fp, mode="r", formats=None):
|
||||||
if i not in OPEN:
|
if i not in OPEN:
|
||||||
init()
|
init()
|
||||||
try:
|
try:
|
||||||
factory, accept = OPEN[i]
|
factory, accept = OPEN[i.upper()]
|
||||||
result = not accept or accept(prefix)
|
result = not accept or accept(prefix)
|
||||||
if type(result) in [str, bytes]:
|
if type(result) in [str, bytes]:
|
||||||
accept_warnings.append(result)
|
accept_warnings.append(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user