mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-21 16:11:10 +00:00

* docker works * more epub tests * changelog version * support epub + odt + rtf * update dockerfile * revert.. * install pandoc on ci env * pandoc docker grab bashed on arch * move arch into image * move back to base image
23 lines
715 B
Python
23 lines
715 B
Python
import os
|
|
import pathlib
|
|
|
|
from unstructured.documents.elements import Title
|
|
from unstructured.partition.rtf import partition_rtf
|
|
|
|
DIRECTORY = pathlib.Path(__file__).parent.resolve()
|
|
|
|
|
|
def test_partition_rtf_from_filename():
|
|
filename = os.path.join(DIRECTORY, "..", "..", "example-docs", "fake-doc.rtf")
|
|
elements = partition_rtf(filename=filename)
|
|
assert len(elements) > 0
|
|
assert elements[0] == Title("My First Heading")
|
|
|
|
|
|
def test_partition_rtf_from_file():
|
|
filename = os.path.join(DIRECTORY, "..", "..", "example-docs", "fake-doc.rtf")
|
|
with open(filename, "rb") as f:
|
|
elements = partition_rtf(file=f)
|
|
assert len(elements) > 0
|
|
assert elements[0] == Title("My First Heading")
|