如何在 python unittest 中检查断言空字符串?

Hou*_*run 1 python-2.7 python-unittest

我有一个问题,我想msg = ''在 python unittest 中测试给定的空字符串,但我找不到正确的断言函数。

我尝试过:

self.assertIsNone(msg)
Run Code Online (Sandbox Code Playgroud)

但我得到了一个错误

AssertionError: '' is not None
Run Code Online (Sandbox Code Playgroud)

所以我继续

self.assertIsEmpty(msg)
Run Code Online (Sandbox Code Playgroud)

但我得到了

object has no attribute 'assertIsEmpty'
Run Code Online (Sandbox Code Playgroud)

因此,在unittest中检查空字符串的正确方法是什么?谢谢