#NEWLINE# def test_inport_outport_connection( inport , outport ) : #NEWLINE# #INDENT# out_endpoint = LocalOutEndpoint ( in_endpoint , inport ) #NEWLINE# in_endpoint = LocalInEndpoint ( inport , outport ) #NEWLINE# outport . attach_endpoint ( out_endpoint ) #NEWLINE# inport . attach_endpoint ( in_endpoint ) #NEWLINE# assert outport . can_write ( ) #NEWLINE# assert ( outport . available_tokens ( ) == 4 ) #NEWLINE# outport . write_token ( 1 ) #NEWLINE# assert ( outport . available_tokens ( ) == 3 ) #NEWLINE# assert ( inport . available_tokens ( ) == 1 ) #NEWLINE# assert ( inport . peek_token ( ) == 1 ) #NEWLINE# inport . peek_rewind ( ) #NEWLINE# assert ( inport . read_token ( ) == 1 ) #NEWLINE# assert ( inport . available_tokens ( ) == 0 )