【发布时间】:2019-07-09 04:01:24
【问题描述】:
我有一个问题,我想在 python unittest 中测试给定的空字符串msg = '',但我找不到合适的断言函数。
我试过了:
self.assertIsNone(msg)
但是我遇到了一个错误
AssertionError: '' is not None
所以我继续
self.assertIsEmpty(msg)
但我得到了
object has no attribute 'assertIsEmpty'
因此,在 unittest 中检查空字符串的正确方法是什么?谢谢
【问题讨论】:
标签: python-2.7 python-unittest