MCPcopy
hub / github.com/huggingface/datasets / test_pdf_feature_encode_example

Function test_pdf_feature_encode_example

tests/features/test_pdf.py:24–34  ·  view source on GitHub ↗
(shared_datadir, build_example)

Source from the content-addressed store, hash-verified

22 ],
23)
24def test_pdf_feature_encode_example(shared_datadir, build_example):
25 import pdfplumber
26
27 pdf_path = str(shared_datadir / "test_pdf.pdf")
28 pdf = Pdf()
29 encoded_example = pdf.encode_example(build_example(pdf_path))
30 assert isinstance(encoded_example, dict)
31 assert encoded_example.keys() == {"bytes", "path"}
32 assert encoded_example["bytes"] is not None or encoded_example["path"] is not None
33 decoded_example = pdf.decode_example(encoded_example)
34 assert isinstance(decoded_example, pdfplumber.pdf.PDF)
35
36
37@require_pdfplumber

Callers

nothing calls this directly

Calls 3

encode_exampleMethod · 0.95
decode_exampleMethod · 0.95
PdfClass · 0.90

Tested by

no test coverage detected