mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-18 03:04:45 +03:00
Merge a8f88988be
into b7a27533b1
This commit is contained in:
commit
3b03cd8192
10
PIL/Image.py
10
PIL/Image.py
|
@ -2512,6 +2512,16 @@ def register_extension(id, extension):
|
||||||
EXTENSION[extension.lower()] = id.upper()
|
EXTENSION[extension.lower()] = id.upper()
|
||||||
|
|
||||||
|
|
||||||
|
def registered_extensions():
|
||||||
|
"""
|
||||||
|
Returns a dictionary containing all file extensions belonging
|
||||||
|
to registered plugins
|
||||||
|
"""
|
||||||
|
if not bool(EXTENSION):
|
||||||
|
init()
|
||||||
|
return EXTENSION
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# Simple display support. User code may override this.
|
# Simple display support. User code may override this.
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,24 @@ class TestImage(PillowTestCase):
|
||||||
img_colors = sorted(img.getcolors())
|
img_colors = sorted(img.getcolors())
|
||||||
self.assertEqual(img_colors, expected_colors)
|
self.assertEqual(img_colors, expected_colors)
|
||||||
|
|
||||||
|
def test_registered_extensions_uninitialized(self):
|
||||||
|
# Act
|
||||||
|
ext = Image.registered_extensions()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
self.assertEqual(bool(ext), True)
|
||||||
|
|
||||||
|
def test_registered_extensions(self):
|
||||||
|
# Arrange
|
||||||
|
# Open an image to trigger plugin registration
|
||||||
|
Image.open('Tests/images/rgb.jpg')
|
||||||
|
|
||||||
|
# Act
|
||||||
|
ext = Image.registered_extensions()
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
self.assertEqual(bool(ext), True)
|
||||||
|
|
||||||
def test_effect_mandelbrot(self):
|
def test_effect_mandelbrot(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
size = (512, 512)
|
size = (512, 512)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user