这pytest也太奇怪了吧
This commit is contained in:
7
.idea/CourseInformer.iml
generated
7
.idea/CourseInformer.iml
generated
@@ -4,10 +4,11 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13 virtualenv at ~/PycharmProjects/CourseInformer/.venv" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PackageRequirementsSettings">
|
||||
<option name="versionSpecifier" value="大于或等于 (>=x.y.z)" />
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="GOOGLE" />
|
||||
<option name="myDocStringFormat" value="Google" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -25,11 +25,12 @@ curl -s -o /dev/null -X POST http://127.0.0.1:3000/send_private_msg \
|
||||
定义方法publish_info负责推送,该类只暴露publish_info方法,如果涉及其他方法以及字段,均需要以`_`开头进行私有化
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
import requests
|
||||
import os
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
15
main.py
15
main.py
@@ -42,12 +42,11 @@
|
||||
通知将在合适时间发送,可使用时间轮算法完成周、日的课程安排,但需要先对reader返回的课程时间进行解析。该脚本将持续运行并检测安排,在合适的时间发送通知
|
||||
"""
|
||||
|
||||
import time
|
||||
import datetime
|
||||
from typing import List
|
||||
import reader
|
||||
import informer
|
||||
import time
|
||||
|
||||
import informer
|
||||
import reader
|
||||
|
||||
# 课程时间安排
|
||||
CLASS_SCHEDULE = {
|
||||
@@ -102,7 +101,7 @@ def _get_current_week(start_date: datetime.date = datetime.date(2025, 8, 25)) ->
|
||||
today = datetime.date.today()
|
||||
delta = today - start_date
|
||||
week = delta.days // 7 + 1
|
||||
return max(week, 1) # 确保至少为第1周
|
||||
return week # 确保至少为第1周
|
||||
|
||||
|
||||
def _get_notification_time(period: str, timeslot_from: int) -> str:
|
||||
@@ -290,7 +289,7 @@ def _test_day_notifications(courses, current_week: int, current_day: str, day_na
|
||||
# _send_course_notification(course, course.period)
|
||||
|
||||
|
||||
def test_notification_logic():
|
||||
def _test_notification_logic():
|
||||
"""测试方法:模拟第一周第一天、第二天、第三天的课程安排通知逻辑"""
|
||||
print("开始测试通知逻辑...")
|
||||
|
||||
@@ -320,7 +319,7 @@ def test_notification_logic():
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 运行测试方法
|
||||
test_notification_logic()
|
||||
# _test_notification_logic()
|
||||
|
||||
# 如果要运行主方法,取消下面的注释
|
||||
# main()
|
||||
main()
|
||||
@@ -2,10 +2,11 @@
|
||||
Module for reading course schedule information from HTML file
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
import os
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
beautifulsoup4>=4.13.4
|
||||
requests>=2.32.5
|
||||
Reference in New Issue
Block a user