forked from chrismattmann/tika-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_parser.py
More file actions
44 lines (28 loc) · 1.08 KB
/
Copy pathtest_parser.py
File metadata and controls
44 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# SPDX-License-Identifier: Apache-2.0
from http import HTTPStatus
from tika import parser
def test_remote_pdf():
"""parse remote PDF"""
assert parser.from_file(
"https://upload.wikimedia.org/wikipedia/commons/4/42/Article_feedback_flow_B_-_Thank_editors.pdf")
def test_remote_html():
"""parse remote HTML"""
assert parser.from_file("http://nossl.sh")
def test_remote_mp3():
"""parse remote mp3"""
assert parser.from_file(
"https://archive.org/download/Ainst-Spaceshipdemo.mp3/Ainst-Spaceshipdemo.mp3")
def test_remote_jpg():
"""parse remote jpg"""
assert parser.from_file(
"https://upload.wikimedia.org/wikipedia/commons/b/b7/X_logo.jpg")
def test_local_binary(test_file_path):
"""parse file binary"""
with open(test_file_path, "rb") as file_obj:
assert parser.from_file(file_obj)
def test_local_buffer():
response = parser.from_buffer("Good evening, Dave")
assert response["status"] == HTTPStatus.OK
def test_local_path(test_file_path):
"""parse file path"""
assert parser.from_file(str(test_file_path))