all this won't work. even changing side_effect
to something completelly different won't solve a problem.
mock = unittest.mock.MagicMock()
with unittest.mock.patch('builtins.set', mock):
handle = set()
print(mock.called)
import builtins
mock = unittest.mock.MagicMock()
with unittest.mock.patch.object(builtins, "set"):
handle = set()
I actually need somehow to know, if nested function uses some classes\methods\structures. For instance, set(), tuple(), dict() | {}
.
For instance, it works with dict()
, but when you use {}
, there is False
returns. Is there any convenient way to introspect code in assertions, thinking about it as a black-box?