add a regression test pinning down extract_items precedence: when a PictureItem has both an inline image.uri AND a fallback in existing_picture_data, the live URI wins.
This commit is contained in:
parent
875c635a77
commit
35e6568f59
1 changed files with 11 additions and 0 deletions
|
|
@ -470,6 +470,17 @@ class TestExtractItemsPictureBytes:
|
|||
picture_items = [i for i in items if i.label == "picture"]
|
||||
assert picture_items[0].picture_data == b"snapshot-picture-bytes"
|
||||
|
||||
def test_live_image_uri_wins_over_existing_picture_data(self):
|
||||
"""When both an inline URI and a snapshot are available, the URI wins."""
|
||||
doc = _docling_doc_with_picture()
|
||||
snapshot = {"#/pictures/0": b"snapshot-bytes-should-not-be-used"}
|
||||
items = extract_items("doc-1", doc, existing_picture_data=snapshot)
|
||||
picture_items = [i for i in items if i.label == "picture"]
|
||||
data = picture_items[0].picture_data
|
||||
assert data is not None
|
||||
assert data.startswith(b"\x89PNG")
|
||||
assert data != b"snapshot-bytes-should-not-be-used"
|
||||
|
||||
|
||||
class TestExtractItemTextDescription:
|
||||
"""A2b: extract_item_text returns VLM description text for PictureItems."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue