如何断言 aMock
和/或 a上的属性已MagicMock
被访问?
例如,
from unittest.mock import MagicMock
def foo(x):
a = x.value
m = MagicMock()
foo(m)
m.attr_accessed('value') # method that does not exist but I wish did; should return True
检查foo
尝试访问的实际方法是什么m.value
?