Comments (2)
- 字符串与Message的比较
测试是严谨的断言,不仅是内容比较,也是类型比较。string类型明显于预期Message类型不符,属于测试不通过。
例如 onebot 协议中,matcher.send("[CQ:foo]")
和 matcher.send(Message("[CQ:foo]"))
是两种完全不同的意义
- 自定义消息判断
测试中的随机事件尽量用 monkeypatch 替换掉,详情可以参考 pytest 文档,正则的话可能以后会考虑
from nonebug.
2 我感觉可以简单回复一下。
如果有这种需求,可以考虑自己写一下。
因为单元测试本身就是要求完全一致。
你可以这样操作。这个测试期望返回值是 True
。
然后你的代码里就这样写
actual_result = 你的功能()
if 你觉得对(actual_result) :
return True
else :
return False
from nonebug.
Related Issues (6)
- 测试用例判断中关于用例参数类型判断的问题
- 对on_command事件响应器的测试与预期不符 HOT 7
- feat: Report need HOT 4
- 更好的文本差异比较 HOT 3
- 运行测试时要如何调用@driver.on_startup装饰的函数呢 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonebug.