• jjjalljs@ttrpg.network
    link
    fedilink
    arrow-up
    4
    ·
    2 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.