Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage #122

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Drop old deprecated code
  • Loading branch information
zerolab committed Jul 7, 2023
commit b86d9fb56c4423341da0b71db039e7484acc67f6
4 changes: 0 additions & 4 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def test_opens_jpeg(self):
image = Image.open(f)
self.assertIsInstance(image, JPEGImageFile)
self.assertEqual(image.format_name, "jpeg")
self.assertEqual(image.original_format, "jpeg")
self.assertEqual(image.mime_type, "image/jpeg")

def test_opens_png(self):
Expand All @@ -63,7 +62,6 @@ def test_opens_png(self):
image = Image.open(f)
self.assertIsInstance(image, PNGImageFile)
self.assertEqual(image.format_name, "png")
self.assertEqual(image.original_format, "png")
self.assertEqual(image.mime_type, "image/png")

def test_opens_gif(self):
Expand All @@ -74,7 +72,6 @@ def test_opens_gif(self):
image = Image.open(f)
self.assertIsInstance(image, GIFImageFile)
self.assertEqual(image.format_name, "gif")
self.assertEqual(image.original_format, "gif")
self.assertEqual(image.mime_type, "image/gif")

def test_raises_error_on_invalid_header(self):
Expand All @@ -90,7 +87,6 @@ def test_opens_svg(self):
image = Image.open(f)
self.assertIsInstance(image, SvgImageFile)
self.assertEqual(image.format_name, "svg")
self.assertEqual(image.original_format, "svg")

def test_invalid_svg_raises(self):
f = io.BytesIO(b"<svg><")
Expand Down
11 changes: 0 additions & 11 deletions willow/image.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import re
import warnings

import filetype
from defusedxml import ElementTree
from filetype.types import image as image_types

from .registry import registry
from .utils.deprecation import RemovedInWillow05Warning


class UnrecognisedImageFormatError(IOError):
Expand Down Expand Up @@ -178,15 +176,6 @@ def mime_type(self):
"""
raise NotImplementedError

@property
def original_format(self):
warnings.warn(
"Image.original_format has been renamed to Image.format_name.",
RemovedInWillow05Warning,
)

return self.format_name

def __init__(self, f):
self.f = f

Expand Down
2 changes: 1 addition & 1 deletion willow/utils/deprecation.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class RemovedInWillow05Warning(DeprecationWarning):
class RemovedInWillow17Warning(DeprecationWarning):
pass