I try to mock simplify_logic
method from sympy python library .
mock = MagicMock(sympy.logic.boolalg.simplify_logic)
The mock has been failing with the following message pointing to another module.
AttributeError: module 'sympy.core.logic' has no attribute 'boolalg'
I also try @patch
but I got the same error.
How can this mocking issue be resolved?
The module under test was another module referred. That module was using the sympy
library.
When I change the mock to refer to the module under test, the mock worked.
with patch('module_under_test.simplify_logic') as simplify_logic_mock:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.