- Implemented `test_dose_parsing_simple.py` to validate the dose parsing workflow. - Created `test_dose_save.py` to verify the saving functionality of dose tracking. - Added `test_dose_save_simple.py` for programmatic testing of dose saving without UI interaction. - Developed `test_final_workflow.py` to test the complete dose tracking workflow, ensuring doses are preserved during edits. - Enhanced `conftest.py` with a mock pathology manager for testing. - Updated `test_data_manager.py` to include pathology manager in DataManager tests and ensure compatibility with new features.
71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple test for dynamic edit window creation without GUI display.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
|
|
from data_manager import DataManager
|
|
from medicine_manager import MedicineManager
|
|
from pathology_manager import PathologyManager
|
|
|
|
|
|
def test_dynamic_edit_data():
|
|
"""Test that we can create dynamic edit data structures."""
|
|
print("Testing dynamic edit data creation...")
|
|
|
|
# Initialize managers
|
|
medicine_manager = MedicineManager()
|
|
pathology_manager = PathologyManager()
|
|
|
|
# Load configurations
|
|
pathologies = pathology_manager.get_all_pathologies()
|
|
medicines = medicine_manager.get_all_medicines()
|
|
|
|
print(f"✅ Loaded {len(pathologies)} pathologies:")
|
|
for key, pathology in pathologies.items():
|
|
print(f" - {key}: {pathology.display_name} ({pathology.scale_info})")
|
|
|
|
print(f"✅ Loaded {len(medicines)} medicines:")
|
|
for key, medicine in medicines.items():
|
|
print(f" - {key}: {medicine.display_name} ({medicine.dosage_info})")
|
|
|
|
# Test data creation
|
|
test_data = {"Date": "2025-07-31", "Note": "Test entry"}
|
|
|
|
# Add pathology values
|
|
for pathology_key in pathologies:
|
|
test_data[pathology_key] = 3
|
|
|
|
# Add medicine values
|
|
for medicine_key in medicines:
|
|
test_data[medicine_key] = 1
|
|
test_data[f"{medicine_key}_doses"] = "08:00: 25mg"
|
|
|
|
print(f"✅ Created test data with {len(test_data)} fields")
|
|
|
|
# Test data manager
|
|
data_manager = DataManager(
|
|
csv_file="thechart_data.csv",
|
|
medicine_manager=medicine_manager,
|
|
pathology_manager=pathology_manager,
|
|
)
|
|
|
|
# Check dynamic columns
|
|
expected_columns = data_manager.get_expected_columns()
|
|
print(f"✅ Data manager expects {len(expected_columns)} columns:")
|
|
for col in expected_columns:
|
|
print(f" - {col}")
|
|
|
|
print("\n🎉 All dynamic data tests passed!")
|
|
print("The pathology system is fully dynamic and integrated!")
|
|
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_dynamic_edit_data()
|