1# test that socket.connect() on a non-blocking socket raises EINPROGRESS 2 3try: 4 import usocket as socket 5except: 6 import socket 7 8 9def test(peer_addr): 10 s = socket.socket() 11 s.setblocking(False) 12 try: 13 s.connect(peer_addr) 14 except OSError as er: 15 print(er.args[0] == 115) # 115 is EINPROGRESS 16 s.close() 17 18 19if __name__ == "__main__": 20 test(socket.getaddrinfo("micropython.org", 80)[0][-1]) 21