diff --git a/nonebot_bison/admin_page/__init__.py b/nonebot_bison/admin_page/__init__.py index 6eda5c0..372750a 100644 --- a/nonebot_bison/admin_page/__init__.py +++ b/nonebot_bison/admin_page/__init__.py @@ -52,7 +52,7 @@ def init_fastapi(): app.mount("/bison", nonebot_app, "nonebot-bison") driver = get_driver() - register_router_fastapi(driver, socket_app) + register_router_fastapi(driver, socket_app) # type: ignore host = str(driver.config.host) port = driver.config.port if host in ["0.0.0.0", "127.0.0.1"]: diff --git a/nonebot_bison/post/custom_post.py b/nonebot_bison/post/custom_post.py index 4921bc2..04d6163 100644 --- a/nonebot_bison/post/custom_post.py +++ b/nonebot_bison/post/custom_post.py @@ -11,7 +11,7 @@ from .abstract_post import BasePost, AbstractPost @dataclass class _CustomPost(BasePost): ms_factories: list[MessageSegmentFactory] = field(default_factory=list) - css_path: str | None = None # 模板文件所用css路径 + css_path: str = "" # 模板文件所用css路径 async def generate_text_messages(self) -> list[MessageSegmentFactory]: return self.ms_factories diff --git a/tests/platforms/test_rss.py b/tests/platforms/test_rss.py index bb80a2f..c380d48 100644 --- a/tests/platforms/test_rss.py +++ b/tests/platforms/test_rss.py @@ -46,7 +46,9 @@ def update_time_feed_1(): root = ET.fromstring(file) item = root.find("channel/item") current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z") + assert item is not None pubdate_elem = item.find("pubDate") + assert pubdate_elem is not None pubdate_elem.text = current_time return ET.tostring(root, encoding="unicode") @@ -57,6 +59,7 @@ def update_time_feed_2(): root = ET.fromstring(file) current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z") published_element = root.find(".//{*}published") + assert published_element is not None published_element.text = current_time return ET.tostring(root, encoding="unicode")