def test_should_not_fail_with_empty_document(self): structured_document = SimpleStructuredDocument() annotate_structured_document_using_predicted_images( structured_document, [])
def test_should_return_empty_token_list_if_document_has_no_lines(self): structured_document = SimpleStructuredDocument( SimplePage([], bounding_box=PAGE_BOUNDING_BOX)) assert list( structured_document_to_token_props(structured_document)) == []
def test_should_return_single_token_text(self): structured_document = SimpleStructuredDocument( SimplePage([SimpleLine([SimpleToken(TEXT_1)])], bounding_box=PAGE_BOUNDING_BOX)) result = list(structured_document_to_token_props(structured_document)) assert [t.get('text') for t in result] == [TEXT_1]
def test_should_return_empty_token_list_if_document_has_no_pages(self): structured_document = SimpleStructuredDocument([]) assert list( structured_document_to_token_props(structured_document)) == []