testing.
assert_string_equal
测试两个字符串是否相等。
如果给定的字符串相等, assert_string_equal 什么也不做。如果它们不相等,将引发断言错误,并显示字符串之间的差异。
要根据预期字符串测试相等性的字符串。
所需的字符串。
实例
>>> np.testing.assert_string_equal('abc', 'abc') >>> np.testing.assert_string_equal('abc', 'abcd') Traceback (most recent call last): File "<stdin>", line 1, in <module> ... AssertionError: Differences in strings: - abc+ abcd? +