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

* add example rst file * filetype detection for rst files * add partition_rst function * add partition_rst to auto * update readme * update docs * changelog and version * pandocs -> pandoc * fix typo
18 lines
588 B
Python
18 lines
588 B
Python
from unstructured.documents.elements import Title
|
|
from unstructured.partition.rst import partition_rst
|
|
|
|
|
|
def test_partition_rst_from_filename(filename="example-docs/README.rst"):
|
|
elements = partition_rst(filename=filename)
|
|
|
|
assert elements[0] == Title("Example Docs")
|
|
assert elements[0].metadata.filetype == "text/x-rst"
|
|
|
|
|
|
def test_partition_rst_from_file(filename="example-docs/README.rst"):
|
|
with open(filename, "rb") as f:
|
|
elements = partition_rst(file=f)
|
|
|
|
assert elements[0] == Title("Example Docs")
|
|
assert elements[0].metadata.filetype == "text/x-rst"
|