Skip to content

Commit

Permalink
DEP: Correct deprecation of interiour_color (#2947)
Browse files Browse the repository at this point in the history
We want this removed in pypdf 6.0.0, updated to do this.
  • Loading branch information
j-t-1 authored Nov 15, 2024
1 parent 4dfea91 commit de5d115
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pypdf/annotations/_markup_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import ABC
from typing import Any, List, Optional, Tuple, Union

from .._utils import deprecate_with_replacement
from .._utils import deprecation_with_replacement
from ..constants import AnnotationFlag
from ..generic import ArrayObject, DictionaryObject
from ..generic._base import (
Expand Down Expand Up @@ -219,7 +219,7 @@ def __init__(
**kwargs: Any,
):
if "interiour_color" in kwargs:
deprecate_with_replacement("interiour_color", "interior_color", "6.0.0")
deprecation_with_replacement("interiour_color", "interior_color", "5.0.0")
interior_color = kwargs["interiour_color"]
del kwargs["interiour_color"]
super().__init__(**kwargs)
Expand Down Expand Up @@ -271,7 +271,7 @@ def __init__(
**kwargs: Any,
):
if "interiour_color" in kwargs:
deprecate_with_replacement("interiour_color", "interior_color", "6.0.0")
deprecation_with_replacement("interiour_color", "interior_color", "5.0.0")
interior_color = kwargs["interiour_color"]
del kwargs["interiour_color"]
super().__init__(**kwargs)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Rectangle,
Text,
)
from pypdf.errors import DeprecationError
from pypdf.generic import ArrayObject, FloatObject, NumberObject

TESTS_ROOT = Path(__file__).parent.resolve()
Expand All @@ -34,7 +35,7 @@ def test_ellipse_annotation(pdf_file_path):
writer.add_page(page)

# Act
with pytest.warns(DeprecationWarning):
with pytest.raises(DeprecationError):
ellipse_annotation = Ellipse(
rect=(50, 550, 500, 650),
interiour_color="ff0000",
Expand Down Expand Up @@ -235,7 +236,7 @@ def test_square(pdf_file_path):
writer.add_page(page)

# Act
with pytest.warns(DeprecationWarning):
with pytest.raises(DeprecationError):
square_annotation = Rectangle(
rect=(50, 550, 200, 650), interiour_color="ff0000"
)
Expand Down

0 comments on commit de5d115

Please sign in to comment.