1
這是按預期工作:Pytest斷言
def my_method():
return True;
def test_method():
assert my_method()
但是,這並不:
assert filecmp.cmp(path1, path2)
相反,我得到:
AssertionError: assert <function cmp at 0x1042db840>((((('/Users/vital...my-path
我當然可以分配結果(True
或False
從filecmp.cmp()
)到變量和assert
這變量,但爲什麼assert
適用於第一種方法,但不適用於第二種方法?也許有從filecmp.cmp()
到assert
的方法嗎?