-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d18a8e9
commit 95282f0
Showing
2 changed files
with
27 additions
and
33 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
python-threatexchange/threatexchange/content_type/tests/test_file_content_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
from threatexchange.content_type.photo import PhotoContent | ||
from threatexchange.content_type.video import VideoContent | ||
from threatexchange.content_type.file_content import FileContent | ||
|
||
@pytest.mark.parametrize("file_name,expected_content_type", [ | ||
("file.jpg", PhotoContent), | ||
("file.JPG", PhotoContent), | ||
("file.mp4", VideoContent), | ||
("file.MP4", VideoContent), | ||
("archive.photo.png", PhotoContent), | ||
("movie.backup.mp4", VideoContent), | ||
]) | ||
def test_file_content_detection(file_name, expected_content_type): | ||
""" | ||
Tests that FileContent correctly identifies the content type | ||
as either PhotoContent or VideoContent based on file extension. | ||
""" | ||
content_type = FileContent.get_content_type_from_filename(file_name) | ||
assert content_type == expected_content_type, f"Failed for {file_name}" | ||
|
||
def test_unknown_file_type(): | ||
""" | ||
Tests that an unknown file type returns None. | ||
""" | ||
file_content = FileContent.get_content_type_from_filename("file.txt") | ||
assert file_content is None |
33 changes: 0 additions & 33 deletions
33
python-threatexchange/threatexchange/tests/test_file_content_type.py
This file was deleted.
Oops, something went wrong.