mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
📝 Docs: 修复单元测试示例代码 (#2741)
This commit is contained in:
parent
c769f95688
commit
38e42919b7
@ -150,7 +150,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
```
|
||||
|
||||
@ -165,7 +165,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
async with app.test_matcher(weather) as ctx:
|
||||
bot = ctx.create_bot()
|
||||
@ -184,7 +184,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -56,7 +56,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -95,7 +95,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -131,7 +131,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -202,7 +202,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -264,7 +264,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -150,7 +150,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
```
|
||||
|
||||
@ -165,7 +165,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
async with app.test_matcher(weather) as ctx:
|
||||
bot = ctx.create_bot()
|
||||
@ -184,7 +184,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -56,7 +56,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -95,7 +95,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -131,7 +131,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -202,7 +202,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -264,7 +264,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -150,7 +150,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
```
|
||||
|
||||
@ -165,7 +165,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
async with app.test_matcher(weather) as ctx:
|
||||
bot = ctx.create_bot()
|
||||
@ -184,7 +184,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -56,7 +56,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -95,7 +95,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -131,7 +131,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -202,7 +202,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -264,7 +264,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -150,7 +150,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
```
|
||||
|
||||
@ -165,7 +165,7 @@ async def test_weather(app: App):
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message("/天气 北京"),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
async with app.test_matcher(weather) as ctx:
|
||||
bot = ctx.create_bot()
|
||||
@ -184,7 +184,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
@ -56,7 +56,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -95,7 +95,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -131,7 +131,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -202,7 +202,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -264,7 +264,7 @@ def make_event(message: str = "") -> MessageEvent:
|
||||
time=datetime.now(),
|
||||
self_id="test",
|
||||
message=Message(message),
|
||||
user=User(user_id=123456789),
|
||||
user=User(id="user"),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
Loading…
Reference in New Issue
Block a user