According to unittest doc (https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.configure_mock) and verified personally,
mock = Mock(some_attribute='eggs', **{'method.return_value': 3, 'other.side_effect': KeyError})
works.
Also verified
mock = Mock(some_attribute='eggs', method.return_value=3, other.side_effect=KeyError)
will raise SyntaxError: keyword can't be an expression
Should these 2 be equivalent at syntax level? What happened in the dict unpacking? If 2 doesn't work, how is 1 being handled? Is there a way to achieve the Mock init without using "**"?
Tested snippet 1: works; Tested snippet 2: raise error; Asked ChatGPT-3.5: It tells nothing valuable but keeps contradicting itself and apologizing to me. Maybe I should upgrade to 4.