|
|
""" |
|
|
Test suite for Trans for Doctors project |
|
|
""" |
|
|
|
|
|
import pytest |
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
def test_imports(): |
|
|
"""Test that all modules can be imported""" |
|
|
try: |
|
|
import stt |
|
|
import knowledge_base |
|
|
import corrector |
|
|
import pipeline |
|
|
assert True |
|
|
except ImportError as e: |
|
|
pytest.fail(f"Failed to import module: {e}") |
|
|
|
|
|
|
|
|
def test_project_structure(): |
|
|
"""Test that all required directories exist""" |
|
|
required_dirs = [ |
|
|
"stt", |
|
|
"knowledge_base", |
|
|
"corrector", |
|
|
"pipeline", |
|
|
"results", |
|
|
"logs" |
|
|
] |
|
|
|
|
|
for dir_name in required_dirs: |
|
|
dir_path = project_root / dir_name |
|
|
assert dir_path.exists(), f"Directory {dir_name} not found" |
|
|
|
|
|
|
|
|
def test_medical_terms_file(): |
|
|
"""Test that medical terms file exists""" |
|
|
terms_file = project_root / "medical_terms.txt" |
|
|
assert terms_file.exists(), "medical_terms.txt not found" |
|
|
|
|
|
|
|
|
content = terms_file.read_text(encoding='utf-8') |
|
|
assert len(content) > 0, "medical_terms.txt is empty" |
|
|
|
|
|
|
|
|
def test_readme_files(): |
|
|
"""Test that README files exist in all modules""" |
|
|
modules_with_readme = [ |
|
|
"stt", |
|
|
"knowledge_base", |
|
|
"corrector", |
|
|
"pipeline" |
|
|
] |
|
|
|
|
|
for module in modules_with_readme: |
|
|
readme = project_root / module / "README.md" |
|
|
assert readme.exists(), f"README.md not found in {module}" |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
pytest.main([__file__, "-v"]) |
|
|
|