Files
kadastr14/test_modules.py

57 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Тестовый скрипт для проверки работы новой модульной структуры
"""
def test_modules():
"""Тестирует импорт и базовую функциональность модулей"""
print("=== ТЕСТ МОДУЛЬНОЙ СТРУКТУРЫ ===\n")
try:
# Тест импорта моделей
print("1. Тестирование моделей...")
from models.cadastral_record import CadastralRecord
from models.xml_file_info import XMLFileInfo
# Создаем тестовую запись
record = CadastralRecord("74:34:0400003:1234", "test.xml")
print(f" ✅ CadastralRecord создан: {record}")
# Тест сервисов
print("\n2. Тестирование сервисов...")
from services.file_seeker import FileSeeker
from services.excel_processor import ExcelProcessor
# Создаем FileSeeker с тестовой директорией
import tempfile
temp_dir = tempfile.mkdtemp()
seeker = FileSeeker(temp_dir)
print(f" ✅ FileSeeker создан: {seeker}")
# Тест статистики
stats = seeker.get_statistics()
print(f" ✅ Статистика получена: {stats}")
print("\n3. Тестирование Excel процессора...")
# Создаем фиктивный Excel процессор
excel_path = "test.xlsx" # Не существует, но это OK для теста импорта
try:
excel_processor = ExcelProcessor(excel_path)
print(f" ✅ ExcelProcessor создан для: {excel_path}")
except Exception as e:
print(f" ⚠️ ExcelProcessor создан (ожидаемая ошибка файла): {type(e).__name__}")
print("\n🎉 ВСЕ МОДУЛИ УСПЕШНО ИМПОРТИРОВАНЫ И ПРОТЕСТИРОВАНЫ!")
return True
except ImportError as e:
print(f"❌ Ошибка импорта: {e}")
return False
except Exception as e:
print(f"❌ Неожиданная ошибка: {e}")
return False
if __name__ == "__main__":
test_modules()