<s> from __future__ import print_function , unicode_literals <EOL> import socket as real_socket <EOL> OK = "<STR_LIT:OK>" <EOL> ERROR = "<STR_LIT>" <EOL> expected_action = OK <EOL> def reset ( ) : <EOL> global expected_action <EOL> expected_action = OK <EOL> class socket ( object ) : <EOL> def __init__ ( self , * args , ** kargs ) : <EOL> super ( socket , self ) . __init__ ( ) <EOL> def connect ( self , ( hostname , port ) ) : <EOL> if expected_action == OK : <EOL> pass <EOL> elif expected_action == ERROR : <EOL> raise real_socket . error ( "<STR_LIT>" ) <EOL> else : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> def close ( self ) : <EOL> pass </s>
