We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7a9c3a3 + d9b6d2a commit 7151f90Copy full SHA for 7151f90
tests/test_detector.py
@@ -0,0 +1,19 @@
1
+from pathlib import Path
2
+
3
+from tika import detector
4
5
6
+TEST_FILE_PATH = Path(__file__).parent / "files" / "rwservlet.pdf"
7
8
9
+def test_local_binary():
10
+ with open(TEST_FILE_PATH, "rb") as file_obj:
11
+ assert detector.from_file(file_obj) == "application/pdf"
12
13
14
+def test_local_path():
15
+ assert detector.from_file(str(TEST_FILE_PATH)) == "application/pdf"
16
17
18
+def test_local_buffer():
19
+ assert detector.from_buffer("Good evening, David. How are you?") == "text/plain"
0 commit comments