File: test_file_id.py

package info (click to toggle)
fpdf2 2.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,860 kB
  • sloc: python: 39,487; sh: 133; makefile: 12
file content (25 lines) | stat: -rw-r--r-- 524 bytes parent folder | download | duplicates (2)
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
from pathlib import Path

from fpdf import FPDF
from test.conftest import assert_pdf_equal


HERE = Path(__file__).resolve().parent


def test_custom_file_id(tmp_path):
    class PDF(FPDF):
        def file_id(self):
            return "<DEADBEEF><DEADBEEF>"

    pdf = PDF()
    assert_pdf_equal(pdf, HERE / "custom_file_id.pdf", tmp_path)


def test_no_file_id(tmp_path):
    class PDF(FPDF):
        def file_id(self):
            return None

    pdf = PDF()
    assert_pdf_equal(pdf, HERE / "no_file_id.pdf", tmp_path)