Sazzz02 commited on
Commit
a5f24dc
·
verified ·
1 Parent(s): a4b8925

Update test_pipelines.py

Browse files
Files changed (1) hide show
  1. 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 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()
 
 
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()