<s> import unittest <EOL> import os <EOL> from nanomsg_wrappers import set_wrapper_choice , get_default_for_platform <EOL> set_wrapper_choice ( os . environ . get ( '<STR_LIT>' , <EOL> get_default_for_platform ( ) ) ) <EOL> from nanomsg import ( <EOL> PAIR , <EOL> Socket , <EOL> LINGER , <EOL> SOL_SOCKET <EOL> ) <EOL> SOCKET_ADDRESS = os . environ . get ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> LINGER_DEFAULT_VALUE = <NUM_LIT:1000> <EOL> class TestGeneralSocketMethods ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . socket = Socket ( PAIR ) <EOL> def tearDown ( self ) : <EOL> self . socket . close ( ) <EOL> def test_bind ( self ) : <EOL> endpoint = self . socket . bind ( SOCKET_ADDRESS ) <EOL> self . assertNotEqual ( None , endpoint ) <EOL> def test_connect ( self ) : <EOL> endpoint = self . socket . connect ( SOCKET_ADDRESS ) <EOL> self . assertNotEqual ( None , endpoint ) <EOL> def test_is_open_is_true_when_open ( self ) : <EOL> self . assertTrue ( self . socket . is_open ( ) ) <EOL> def test_is_open_is_false_when_closed ( self ) : <EOL> self . socket . close ( ) <EOL> self . assertFalse ( self . socket . is_open ( ) ) <EOL> def test_set_int_option ( self ) : <EOL> expected = <NUM_LIT> <EOL> self . socket . set_int_option ( SOL_SOCKET , LINGER , expected ) <EOL> actual = self . socket . get_int_option ( SOL_SOCKET , LINGER ) <EOL> self . assertEqual ( expected , actual ) <EOL> def test_get_int_option ( self ) : <EOL> actual = self . socket . get_int_option ( SOL_SOCKET , LINGER ) <EOL> self . assertEqual ( LINGER_DEFAULT_VALUE , actual ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
