This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import inject_exception | |
import requests | |
from mock import patch | |
import nose.tools | |
# ...snippet | |
def test_api_call(): | |
with patch.object(requests, "get") as get_mock: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import requests | |
# ...snippet | |
def call_api(url): | |
try: | |
requests.get(url="url") | |
except: | |
socket.error as e: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyPrint: | |
def __init__(self): | |
pass | |
def myPrint(self): | |
for item in range(10): | |
print("This is the item at " + str(item) + " .") | |
return True |
NewerOlder