[issue26232] Mock(spec=spec) has no effect

2016-01-28 Thread David Szotten
David Szotten added the comment: thanks, and apologies for the noise -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue26232] Mock(spec=spec) has no effect

2016-01-28 Thread Michael Foord
Michael Foord added the comment: create_autospec and Mock(spec=spec) are very different. Mock(spec=spec) creates a mock object with the same *attributes* as the original. It does not create functions like create_autospec can. -- resolution: -> not a bug stage: -> resolved status: ope

[issue26232] Mock(spec=spec) has no effect

2016-01-28 Thread SilentGhost
Changes by SilentGhost : -- nosy: +michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue26232] Mock(spec=spec) has no effect

2016-01-28 Thread David Szotten
New submission from David Szotten: Unless i misunderstand the docs, i would expect `Mock(foo)` to have the same effect as `create_autospec(foo)`, but that doesn't appear to be the case: >>> m1 = mock.Mock(spec=lambda: None) >>> m2 = mock.create_autospec(spec=lambda: None) >>> m1(1) >>> m2(1) #