python-2.7 - 如何在python unittest中检查断言空字符串?
问题描述
我有一个问题,我想msg = ''
在 python unittest 中测试给定的空字符串,但我找不到正确的断言函数。
我尝试过:
self.assertIsNone(msg)
但我有一个错误
AssertionError: '' is not None
所以我继续
self.assertIsEmpty(msg)
但我得到了
object has no attribute 'assertIsEmpty'
因此,在 unittest 中检查空字符串的正确方法是什么?谢谢
解决方案
推荐阅读
- wpf - 从样式中将项目添加到集合
- google-cloud-platform - 需要 iam.serviceAccounts.getIamPolicy 才能对服务帐户执行此操作
- angular - 如何从以下服务获取数据?
- php - Tinker 在 Laravel 5.8 中给出异常
- java - 带有巨大 BufferdImage 的小型 pdf 文件结果
- python - 如何在 Keras 中使用 deconv2d 获得与原始输入大小相同的层?
- javascript - 我可以一次跟踪输入字段的文本更改,而不是每次输入吗?
- socket.io - angular Universal + socket.io,如何正确等待浏览器端?
- javascript - Heroku 托管网站 - 非工作 JavaScript
- windows - Tortoise SVN - 菜单项未显示