Skip to content

Commit 7d76f21

Browse files
committed
Updated tests
1 parent aec0c2e commit 7d76f21

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

tests/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
API_KEY = ''
22
FILE_PATH = r''
3-
RESULTS_FOLDER = r''

tests/test_client.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1+
import os
12
import io
23

34
import pytest
45

56
from ExtractTable.client import ExtractTable
6-
from ExtractTable.common import UsageStats
77
from ExtractTable.exceptions import ServiceError
8-
from tests.constants import API_KEY, FILE_PATH, RESULTS_FOLDER
8+
from tests.constants import API_KEY, FILE_PATH
99

1010

1111
@pytest.fixture
1212
def client():
1313
return ExtractTable(API_KEY)
1414

1515

16-
def test_process_file(client: ExtractTable):
17-
assert not (client.process_file(FILE_PATH, RESULTS_FOLDER))
18-
19-
20-
def test_process_file_index(client: ExtractTable):
21-
assert not (client.process_file(FILE_PATH, RESULTS_FOLDER, True))
22-
23-
24-
def test_check_usage(client: ExtractTable):
25-
assert isinstance(client.check_usage(), UsageStats)
16+
def test_get_result_fail(client: ExtractTable):
17+
with pytest.raises(ServiceError):
18+
assert not client.get_result('')
2619

2720

2821
def test_trigger_process_fail(client: ExtractTable):
2922
with pytest.raises(ServiceError):
3023
client.trigger_process(io.BytesIO())
3124

3225

33-
def test_get_result_fail(client: ExtractTable):
34-
with pytest.raises(ServiceError):
35-
assert client.get_result('')
26+
def test_check_usage(client: ExtractTable):
27+
assert isinstance(client.check_usage(), dict)
28+
29+
30+
def test_process_file(client: ExtractTable):
31+
assert isinstance(client.process_file(filepath=FILE_PATH, output_format="df"), list)
3632

3733

34+
def test_process_file_csv(client: ExtractTable, fmt="csv"):
35+
return all([os.path.exists(x) and x.endswith(fmt) for x in client.process_file(filepath=FILE_PATH, output_format=fmt)])

0 commit comments

Comments
 (0)