Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Coniferish committed Oct 4, 2023
1 parent c36d434 commit 70b6082
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions test_unstructured/partition/csv/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ def test_add_chunking_strategy_to_partition_csv_non_default():
assert chunk_elements != elements
assert chunk_elements == chunks


def test_partition_csv_element_metadata_has_languages():
filename = "example-docs/stanley-cups.csv"
elements = partition_csv(filename=filename, strategy="fast")
assert elements[0].metadata.languages == ["eng"]

4 changes: 2 additions & 2 deletions test_unstructured/partition/test_html_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ def test_html_heading_title_detection():
ListItem("- bulleted item"),
]


def test_partition_html_element_metadata_has_languages():
filename = "example-docs/example-10k.html"
elements = partition_html(filename=filename)
assert elements[0].metadata.languages == ["eng"]
assert elements[0].metadata.languages == ["eng"]
7 changes: 4 additions & 3 deletions unstructured/file_utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ def apply_lang_metadata(
yield e
else:
for e in elements:
if not hasattr(e, "text"):
if hasattr(e, "text"):
e.metadata.languages = detect_languages(e.text)
yield e
else:
yield e
continue
e.metadata.languages = detect_languages(e.text)
yield e

0 comments on commit 70b6082

Please sign in to comment.