Spaces:
Sleeping
Sleeping
Delete tests/test_examples.py
Browse files- tests/test_examples.py +0 -116
tests/test_examples.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
import pytest
|
| 2 |
-
|
| 3 |
-
class TestExamples:
|
| 4 |
-
"""Test example medical notes and functionality"""
|
| 5 |
-
|
| 6 |
-
def test_example_notes_exist(self):
|
| 7 |
-
"""Test that example notes are properly defined"""
|
| 8 |
-
examples = {
|
| 9 |
-
'chest_pain': """Patient: John Smith, 45-year-old male
|
| 10 |
-
Chief Complaint: Chest pain for 2 hours
|
| 11 |
-
History: Patient reports sudden onset of sharp chest pain while at work.
|
| 12 |
-
Pain is 7/10 intensity, located substernal, radiating to left arm.""",
|
| 13 |
-
|
| 14 |
-
'diabetes': """Patient: Maria Garcia, 52-year-old female
|
| 15 |
-
Chief Complaint: Increased thirst and frequent urination for 3 weeks
|
| 16 |
-
History: Patient reports polyuria, polydipsia, and unintentional weight loss.""",
|
| 17 |
-
|
| 18 |
-
'pediatric': """Patient: Emma Thompson, 8-year-old female
|
| 19 |
-
Chief Complaint: Fever and sore throat for 2 days
|
| 20 |
-
History: Mother reports fever up to 102°F, sore throat, difficulty swallowing."""
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
assert 'chest_pain' in examples
|
| 24 |
-
assert 'diabetes' in examples
|
| 25 |
-
assert 'pediatric' in examples
|
| 26 |
-
|
| 27 |
-
for key, example in examples.items():
|
| 28 |
-
assert len(example.strip()) > 50 # Ensure examples have substance
|
| 29 |
-
assert "Patient:" in example
|
| 30 |
-
assert "Chief Complaint:" in example
|
| 31 |
-
|
| 32 |
-
def test_example_loading(self):
|
| 33 |
-
"""Test example loading functionality"""
|
| 34 |
-
def mock_load_example(example_key):
|
| 35 |
-
examples = {
|
| 36 |
-
'chest_pain': "Chest pain example loaded",
|
| 37 |
-
'diabetes': "Diabetes example loaded",
|
| 38 |
-
'pediatric': "Pediatric example loaded"
|
| 39 |
-
}
|
| 40 |
-
return examples.get(example_key, "Example not found")
|
| 41 |
-
|
| 42 |
-
assert mock_load_example('chest_pain') == "Chest pain example loaded"
|
| 43 |
-
assert mock_load_example('diabetes') == "Diabetes example loaded"
|
| 44 |
-
assert mock_load_example('pediatric') == "Pediatric example loaded"
|
| 45 |
-
assert mock_load_example('invalid_key') == "Example not found"
|
| 46 |
-
|
| 47 |
-
def test_example_content_quality(self):
|
| 48 |
-
"""Test that examples contain required medical information"""
|
| 49 |
-
examples = {
|
| 50 |
-
'chest_pain': """Patient: John Smith, 45-year-old male
|
| 51 |
-
Chief Complaint: Chest pain for 2 hours
|
| 52 |
-
History: Sharp chest pain, 7/10 intensity
|
| 53 |
-
Physical Exam: VS: BP 150/90, HR 110
|
| 54 |
-
Assessment: Acute chest pain
|
| 55 |
-
Plan: EKG, cardiac enzymes""",
|
| 56 |
-
|
| 57 |
-
'diabetes': """Patient: Maria Garcia, 52-year-old female
|
| 58 |
-
Chief Complaint: Increased thirst and urination
|
| 59 |
-
History: Polyuria, polydipsia, weight loss
|
| 60 |
-
Physical Exam: VS: BP 140/85, BMI 28
|
| 61 |
-
Assessment: New onset diabetes
|
| 62 |
-
Plan: HbA1c, glucose, metformin""",
|
| 63 |
-
|
| 64 |
-
'pediatric': """Patient: Emma Thompson, 8-year-old female
|
| 65 |
-
Chief Complaint: Fever and sore throat
|
| 66 |
-
History: Fever 102°F, sore throat, decreased appetite
|
| 67 |
-
Physical Exam: Throat erythematous, lymphadenopathy
|
| 68 |
-
Assessment: Streptococcal pharyngitis
|
| 69 |
-
Plan: Rapid strep test, amoxicillin"""
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
for key, example in examples.items():
|
| 73 |
-
# Check for essential medical note components
|
| 74 |
-
assert "Patient:" in example
|
| 75 |
-
assert "Chief Complaint:" in example
|
| 76 |
-
assert "History:" in example or "Physical Exam:" in example
|
| 77 |
-
assert "Assessment:" in example
|
| 78 |
-
assert "Plan:" in example
|
| 79 |
-
|
| 80 |
-
# Check for age and gender
|
| 81 |
-
assert any(age in example for age in ['year-old', 'yo', 'years old'])
|
| 82 |
-
assert any(gender in example for gender in ['male', 'female'])
|
| 83 |
-
|
| 84 |
-
def test_example_button_handlers(self):
|
| 85 |
-
"""Test example button click handlers"""
|
| 86 |
-
def mock_example_click_handler(example_text):
|
| 87 |
-
def handler():
|
| 88 |
-
return f"Loaded: {example_text[:20]}..."
|
| 89 |
-
return handler
|
| 90 |
-
|
| 91 |
-
# Test each example handler
|
| 92 |
-
examples = {
|
| 93 |
-
'chest_pain': "Chest pain example text",
|
| 94 |
-
'diabetes': "Diabetes example text",
|
| 95 |
-
'pediatric': "Pediatric example text"
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
for key, text in examples.items():
|
| 99 |
-
handler = mock_example_click_handler(text)
|
| 100 |
-
result = handler()
|
| 101 |
-
assert "Loaded:" in result
|
| 102 |
-
assert text[:20] in result
|
| 103 |
-
|
| 104 |
-
def test_clear_functionality(self):
|
| 105 |
-
"""Test clear button functionality"""
|
| 106 |
-
def mock_clear_handler():
|
| 107 |
-
return {
|
| 108 |
-
'notes_input': '',
|
| 109 |
-
'file_upload': None,
|
| 110 |
-
'output_area': 'Ready to generate SOAP notes!'
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
result = mock_clear_handler()
|
| 114 |
-
assert result['notes_input'] == ''
|
| 115 |
-
assert result['file_upload'] is None
|
| 116 |
-
assert 'Ready to generate' in result['output_area']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|