1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
import pytest
from pathlib import Path
from fpdf import FPDF
HERE = Path(__file__).resolve().parent
def test_TitleStyle_deprecation():
# pylint: disable=import-outside-toplevel
with pytest.warns(DeprecationWarning):
from fpdf import TitleStyle
TitleStyle()
with pytest.warns(DeprecationWarning):
from fpdf.fonts import TitleStyle
TitleStyle()
def test_add_font_uni_deprecation():
pdf = FPDF()
with pytest.warns(DeprecationWarning) as record:
# pylint: disable=unexpected-keyword-arg
pdf.add_font(
"DejaVu",
"",
HERE.parent / "fonts" / "DejaVuSans.ttf",
uni=True,
)
assert (
str(record[0].message)
== '"uni" parameter is deprecated since v2.5.1 and will be removed in a future release'
)
def test_output_dest_deprecation():
pdf = FPDF()
with pytest.warns(DeprecationWarning) as record:
# pylint: disable=unexpected-keyword-arg
pdf.output(dest="S")
assert (
str(record[0].message)
== '"dest" parameter is deprecated since v2.2.0 and will be removed in a future release'
)
|