Create test_pipelines.py
Browse files- test_pipelines.py +18 -0
test_pipelines.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
from app import rag_bot
|
| 3 |
+
|
| 4 |
+
def test_rag_with_pdf():
|
| 5 |
+
# Load a small dummy PDF for testing
|
| 6 |
+
sample_pdf_content = b"%PDF-1.4 sample minimal pdf"
|
| 7 |
+
pdf_file = io.BytesIO(sample_pdf_content)
|
| 8 |
+
pdf_file.name = "test.pdf"
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
answer = rag_bot("What is inside this document?", pdf_file)
|
| 12 |
+
assert isinstance(answer, str)
|
| 13 |
+
print("✅ Bot responded successfully:", answer[:200])
|
| 14 |
+
except Exception as e:
|
| 15 |
+
print("❌ Test failed:", e)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
test_rag_with_pdf()
|