cm0002@suppo.fi to Programmer Humor@programming.dev · 11 hours agoSenior devs...suppo.fiimagemessage-square61fedilinkarrow-up1538arrow-down118
arrow-up1520arrow-down1imageSenior devs...suppo.ficm0002@suppo.fi to Programmer Humor@programming.dev · 11 hours agomessage-square61fedilink
minus-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up7·4 hours ago with patch("some_file.requests.get", side_effect=SomeException("oh no")): result = func_using_requests() Though not every language makes mocking as easy, and multiple responsibilities in a single function can quickly get messy.
minus-squareTamo240@programming.devlinkfedilinkarrow-up4·2 hours agoOh I’m fully aware that python lets you cheat dependency injection with patch, its one of the many things python teaches developers to do wrong, which leads them to be unable to use any other language.
with patch("some_file.requests.get", side_effect=SomeException("oh no")): result = func_using_requests()Though not every language makes mocking as easy, and multiple responsibilities in a single function can quickly get messy.
Oh I’m fully aware that python lets you cheat dependency injection with patch, its one of the many things python teaches developers to do wrong, which leads them to be unable to use any other language.