Skip to content

Commit 689c367

Browse files
committed
test: remove obsolete test utils.py
1 parent ce4c3ca commit 689c367

File tree

4 files changed

+15
-73
lines changed

4 files changed

+15
-73
lines changed

tika/tests/memory_benchmark.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
# python tika/tests/memory_benchmark.py
2020
import os
2121
import zlib
22-
22+
import gzip
2323

2424
import tika.parser
25-
import tika.tika
2625
from memory_profiler import profile
2726

28-
from tika.tests.utils import gzip_compress
29-
3027

3128
@profile
3229
def test_parser_binary():
@@ -62,7 +59,7 @@ def test_parser_gzip():
6259
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
6360

6461
with open(file, 'rb') as file_obj:
65-
response = tika.parser.from_buffer(gzip_compress(file_obj.read()), headers={'Accept-Encoding': 'gzip, deflate'})
62+
response = tika.parser.from_buffer(gzip.compress(file_obj.read()), headers={'Accept-Encoding': 'gzip, deflate'})
6663

6764
if __name__ == '__main__':
6865
test_parser_buffer()

tika/tests/test_benchmark.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,26 @@
2020
import os
2121
import unittest
2222
import zlib
23+
import gzip
24+
from http import HTTPStatus
2325

2426
import tika.parser
25-
import tika.tika
26-
from tika.tests.utils import HTTPStatusOk, gzip_compress
2727

2828

2929
def test_local_binary(benchmark):
3030
"""parse file binary"""
3131
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
3232
response = benchmark(tika_from_binary, file)
3333

34-
assert response['status'] == HTTPStatusOk
34+
assert response['status'] == HTTPStatus.OK
3535

3636

3737
def test_parser_buffer(benchmark):
3838
"""example how to send gzip file"""
3939
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
4040
response = benchmark(tika_from_buffer, file)
4141

42-
assert response['status'] == HTTPStatusOk
42+
assert response['status'] == HTTPStatus.OK
4343

4444

4545
def test_parser_buffer_zlib_input(benchmark):
@@ -48,31 +48,31 @@ def test_parser_buffer_zlib_input(benchmark):
4848

4949
response = benchmark(tika_from_buffer_zlib, file)
5050

51-
assert response['status'] == HTTPStatusOk
51+
assert response['status'] == HTTPStatus.OK
5252

5353

5454
def test_parser_buffer_gzip_input(benchmark):
5555
"""parse file binary"""
5656
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
5757
response = benchmark(tika_from_buffer_gzip, file)
5858

59-
assert response['status'] == HTTPStatusOk
59+
assert response['status'] == HTTPStatus.OK
6060

6161

6262
def test_local_binary_with_gzip_output(benchmark):
6363
"""parse file binary"""
6464
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
6565
response = benchmark(tika_from_binary, file, headers={'Accept-Encoding': 'gzip, deflate'})
6666

67-
assert response['status'] == HTTPStatusOk
67+
assert response['status'] == HTTPStatus.OK
6868

6969

7070
def test_parser_buffer_with_gzip_output(benchmark):
7171
"""example how to send gzip file"""
7272
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
7373
response = benchmark(tika_from_buffer, file, headers={'Accept-Encoding': 'gzip, deflate'})
7474

75-
assert response['status'] == HTTPStatusOk
75+
assert response['status'] == HTTPStatus.OK
7676

7777

7878
def test_parser_buffer_zlib_input_and_gzip_output(benchmark):
@@ -81,15 +81,15 @@ def test_parser_buffer_zlib_input_and_gzip_output(benchmark):
8181

8282
response = benchmark(tika_from_buffer_zlib, file, headers={'Accept-Encoding': 'gzip, deflate'})
8383

84-
assert response['status'] == HTTPStatusOk
84+
assert response['status'] == HTTPStatus.OK
8585

8686

8787
def test_parser_buffer_gzip_input_and_gzip_output(benchmark):
8888
"""parse file binary"""
8989
file = os.path.join(os.path.dirname(__file__), 'files', 'rwservlet.pdf')
9090
response = benchmark(tika_from_buffer_gzip, file, headers={'Accept-Encoding': 'gzip, deflate'})
9191

92-
assert response['status'] == HTTPStatusOk
92+
assert response['status'] == HTTPStatus.OK
9393

9494

9595
def tika_from_buffer_zlib(file, headers=None):
@@ -99,7 +99,7 @@ def tika_from_buffer_zlib(file, headers=None):
9999

100100
def tika_from_buffer_gzip(file, headers=None):
101101
with open(file, 'rb') as file_obj:
102-
return tika.parser.from_buffer(gzip_compress(file_obj.read()), headers=headers)
102+
return tika.parser.from_buffer(gzip.compress(file_obj.read()), headers=headers)
103103

104104

105105
def tika_from_buffer(file, headers=None):

tika/tests/test_tika.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import os
1919
import unittest
20+
from http import HTTPStatus
2021

2122
import tika.parser
2223
import tika.tika
23-
from tika.tests.utils import HTTPStatusOk
2424

2525

2626
class CreateTest(unittest.TestCase):
@@ -53,7 +53,7 @@ def test_local_binary(self):
5353

5454
def test_local_buffer(self):
5555
response = tika.parser.from_buffer('Good evening, Dave')
56-
self.assertEqual(response['status'], HTTPStatusOk)
56+
self.assertEqual(response['status'], HTTPStatus.OK)
5757

5858
def test_local_path(self):
5959
"""parse file path"""

tika/tests/utils.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)