Abid Ali Awan commited on
Commit ·
e29548e
1
Parent(s): 5922f7a
Refactor test assertions in test_app.py to validate string outputs instead of dicts, and utilize handle_file for local file paths.
Browse files- tests/test_app.py +9 -9
tests/test_app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
-
from gradio_client import Client
|
| 2 |
|
| 3 |
client = Client("http://127.0.0.1:7860/")
|
| 4 |
result_1 = client.predict(
|
| 5 |
-
local_file_path="data/test-document.pdf", output_format="docx", api_name="/predict"
|
| 6 |
)
|
| 7 |
print("Link to the document:", result_1)
|
| 8 |
assert (
|
| 9 |
-
isinstance(result_1,
|
| 10 |
-
and result_1
|
| 11 |
-
and result_1.
|
| 12 |
)
|
| 13 |
|
| 14 |
result_2 = client.predict(
|
|
@@ -19,7 +19,7 @@ result_2 = client.predict(
|
|
| 19 |
|
| 20 |
print("Link to the document:", result_2)
|
| 21 |
assert (
|
| 22 |
-
isinstance(result_2,
|
| 23 |
-
and result_2
|
| 24 |
-
and result_2.
|
| 25 |
-
)
|
|
|
|
| 1 |
+
from gradio_client import Client, handle_file
|
| 2 |
|
| 3 |
client = Client("http://127.0.0.1:7860/")
|
| 4 |
result_1 = client.predict(
|
| 5 |
+
local_file_path=handle_file("data/test-document.pdf"), output_format="docx", api_name="/predict"
|
| 6 |
)
|
| 7 |
print("Link to the document:", result_1)
|
| 8 |
assert (
|
| 9 |
+
isinstance(result_1, str)
|
| 10 |
+
and result_1 is not None # Check if the string itself is not None
|
| 11 |
+
and result_1.endswith(".docx")
|
| 12 |
)
|
| 13 |
|
| 14 |
result_2 = client.predict(
|
|
|
|
| 19 |
|
| 20 |
print("Link to the document:", result_2)
|
| 21 |
assert (
|
| 22 |
+
isinstance(result_2, str)
|
| 23 |
+
and result_2 is not None # Check if the string itself is not None
|
| 24 |
+
and result_2.endswith(".pdf")
|
| 25 |
+
)
|