Bonosa2 commited on
Commit
7bc42b8
·
verified ·
1 Parent(s): 31747f7

Create conftest.py

Browse files
Files changed (1) hide show
  1. tests/conftest.py +41 -0
tests/conftest.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ import torch
3
+ from PIL import Image
4
+ import numpy as np
5
+ import tempfile
6
+ import os
7
+
8
+ @pytest.fixture
9
+ def mock_device():
10
+ """Mock device for testing"""
11
+ return "cpu"
12
+
13
+ @pytest.fixture
14
+ def sample_medical_text():
15
+ """Sample medical text for testing"""
16
+ return """
17
+ Patient: John Smith, 45-year-old male
18
+ Chief Complaint: Chest pain for 2 hours
19
+ History: Patient reports sudden onset of sharp chest pain while at work.
20
+ Pain is 7/10 intensity, located substernal, radiating to left arm.
21
+ Physical Exam: VS: BP 150/90, HR 110, RR 22, O2 Sat 96% on RA.
22
+ Patient appears anxious and diaphoretic.
23
+ Assessment: Acute chest pain, rule out myocardial infarction
24
+ Plan: EKG, cardiac enzymes, chest X-ray, aspirin 325mg
25
+ """
26
+
27
+ @pytest.fixture
28
+ def sample_image():
29
+ """Create a sample image for OCR testing"""
30
+ # Create a simple white image with black text
31
+ img = Image.new('RGB', (400, 300), color='white')
32
+ return img
33
+
34
+ @pytest.fixture
35
+ def temp_image_file():
36
+ """Create a temporary image file"""
37
+ with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp:
38
+ img = Image.new('RGB', (400, 300), color='white')
39
+ img.save(tmp.name)
40
+ yield tmp.name
41
+ os.unlink(tmp.name)