<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> ) <EOL> SOCKET_ADDRESS = os . environ . get ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> class TestPairSockets ( unittest . TestCase ) : <EOL> def test_send_recv ( self ) : <EOL> with Socket ( PAIR ) as s1 : <EOL> with Socket ( PAIR ) as s2 : <EOL> s1 . bind ( SOCKET_ADDRESS ) <EOL> s2 . connect ( SOCKET_ADDRESS ) <EOL> sent = b'<STR_LIT>' <EOL> s2 . send ( sent ) <EOL> recieved = s1 . recv ( ) <EOL> self . assertEqual ( sent , recieved ) <EOL> def test_send_recv_with_embeded_nulls ( self ) : <EOL> with Socket ( PAIR ) as s1 : <EOL> with Socket ( PAIR ) as s2 : <EOL> s1 . bind ( SOCKET_ADDRESS ) <EOL> s2 . connect ( SOCKET_ADDRESS ) <EOL> sent = b'<STR_LIT>' <EOL> s2 . send ( sent ) <EOL> recieved = s1 . recv ( ) <EOL> self . assertEqual ( sent , recieved ) <EOL> def test_send_recv_large_message ( self ) : <EOL> with Socket ( PAIR ) as s1 : <EOL> with Socket ( PAIR ) as s2 : <EOL> s1 . bind ( SOCKET_ADDRESS ) <EOL> s2 . connect ( SOCKET_ADDRESS ) <EOL> sent = b'<STR_LIT:B>' * ( <NUM_LIT> * <NUM_LIT> ) <EOL> s2 . send ( sent ) <EOL> recieved = s1 . recv ( ) <EOL> self . assertEqual ( sent , recieved ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
