Skip to content

Commit

Permalink
add additional unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiseck3 committed Dec 19, 2024
1 parent d16085d commit d747e2f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test_unstructured/file_utils/test_filetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ def test_it_detects_correct_file_type_from_file_no_name_with_correct_asserted_co
assert file_type is expected_value


def test_it_identifies_NDJSON_for_file_like_object_with_no_name_but_NDJSON_content_type():
with open(example_doc_path("simple.ndjson"), "rb") as f:
file = io.BytesIO(f.read())
assert detect_filetype(file=file, content_type=FileType.NDJSON.mime_type) == FileType.NDJSON


# TODO: ideally this test should pass, currently fails
# def test_it_identifies_NDJSON_for_file_with_ndjson_extension_but_JSON_content_type():
# file_path = example_doc_path("simple.ndjson")
# assert detect_filetype(file_path, content_type=FileType.JSON.mime_type) == FileType.NDJSON

# ================================================================================================
# STRATEGY #3 - GUESS MIME-TYPE WITH LIBMAGIC/FILETYPE LIBRARY
# ================================================================================================
Expand Down

0 comments on commit d747e2f

Please sign in to comment.