mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-03 23:20:35 +00:00

This PR resolves #1237 by checking if any coordinates are `None`; if yes do not attempt to sort with xy cut method and return the list as is.
11 lines
363 B
Python
11 lines
363 B
Python
import pytest
|
|
|
|
from unstructured.documents.elements import Element
|
|
from unstructured.partition.utils.sorting import sort_page_elements
|
|
|
|
|
|
@pytest.mark.parametrize("sort_mode", ["xy-cut", "basic"])
|
|
def test_sort_page_elements_without_coordinates(sort_mode):
|
|
elements = [Element(str(idx)) for idx in range(5)]
|
|
assert sort_page_elements(elements) == elements
|