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

TST: utils.paeth_predictor #959

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Changes from all commits
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
19 changes: 19 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,29 @@ def test_b():
assert PyPDF2._utils.b_("😀") == "😀".encode()
assert PyPDF2._utils.b_("‰") == "‰".encode()
assert PyPDF2._utils.b_("▷") == "▷".encode()
assert PyPDF2._utils.b_("世") == "世".encode()


def test_deprecate_no_replacement():
with pytest.raises(PendingDeprecationWarning) as exc:
PyPDF2._utils.deprecate_no_replacement("foo")
error_msg = "foo is deprecated and will be removed in PyPDF2 3.0.0."
assert exc.value.args[0] == error_msg


@pytest.mark.parametrize(
("left", "up", "upleft", "expected"),
[
(0, 0, 0, 0),
(1, 0, 0, 1),
(0, 1, 0, 1),
(0, 0, 1, 0),
(1, 2, 3, 1),
(2, 1, 3, 1),
(1, 3, 2, 2),
(3, 1, 2, 2),
(3, 2, 1, 3),
],
)
def test_paeth_predictor(left, up, upleft, expected):
assert PyPDF2._utils.paeth_predictor(left, up, upleft) == expected