Update test_pipelines.py
Browse files- test_pipelines.py +9 -10
test_pipelines.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
-
import io
|
| 2 |
from app import rag_bot
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
pdf_file.name = "test.pdf"
|
| 9 |
|
| 10 |
try:
|
| 11 |
-
answer = rag_bot(
|
| 12 |
assert isinstance(answer, str)
|
| 13 |
-
print("✅ Bot
|
|
|
|
| 14 |
except Exception as e:
|
| 15 |
-
print("❌ Test
|
| 16 |
|
| 17 |
if __name__ == "__main__":
|
| 18 |
-
|
|
|
|
|
|
|
| 1 |
from app import rag_bot
|
| 2 |
|
| 3 |
+
def test_rag_bot():
|
| 4 |
+
# Use a sample small PDF (must exist in repo for testing)
|
| 5 |
+
sample_pdf = "manual.pdf" # Replace with a small test PDF
|
| 6 |
+
question = "What is the purpose of this document?"
|
|
|
|
| 7 |
|
| 8 |
try:
|
| 9 |
+
answer = rag_bot(question, sample_pdf)
|
| 10 |
assert isinstance(answer, str)
|
| 11 |
+
print("✅ Test Passed: Bot returned an answer")
|
| 12 |
+
print("Sample Answer:", answer[:200])
|
| 13 |
except Exception as e:
|
| 14 |
+
print("❌ Test Failed:", e)
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
+
test_rag_bot()
|