41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
날씨 기능 수정 테스트
|
|
"""
|
|
|
|
from database.crud import CRUDManager
|
|
from datetime import datetime
|
|
|
|
def test_weather_fix():
|
|
"""날씨 기능 수정 테스트"""
|
|
crud = CRUDManager()
|
|
print('Testing weather CRUD...')
|
|
|
|
try:
|
|
# 간단한 날씨 데이터 저장
|
|
weather = crud.upsert_weather(
|
|
datetime=datetime(2026, 1, 10, 12, 0),
|
|
location_name='부산',
|
|
location_code='2638057200',
|
|
temp=15,
|
|
weather_condition='맑음'
|
|
)
|
|
print(f'Success: Saved weather {weather.temp}°C')
|
|
|
|
# 통계 조회
|
|
stats = crud.get_weather_stats_for_shift('주간', datetime(2026, 1, 10).date(), '2638057200')
|
|
print(f'Stats: {stats}')
|
|
|
|
# 오래된 데이터 정리 테스트
|
|
crud.cleanup_old_weather_data(7)
|
|
print('Cleanup completed')
|
|
|
|
except Exception as e:
|
|
print(f'Error: {e}')
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == '__main__':
|
|
test_weather_fix()
|