Skip to content

Commit

Permalink
Merge a8f8898 into 0132771
Browse files Browse the repository at this point in the history
  • Loading branch information
lggomez committed Jun 20, 2016
2 parents 0132771 + a8f8898 commit 7617fb4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2476,6 +2476,16 @@ def register_extension(id, extension):
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.

Expand Down
18 changes: 18 additions & 0 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ def test_alpha_composite(self):
img_colors = sorted(img.getcolors())
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):
# Arrange
size = (512, 512)
Expand Down

0 comments on commit 7617fb4

Please sign in to comment.