<s> from gevent import monkey ; monkey . patch_all ( ) <EOL> import socket <EOL> import unittest <EOL> class TestSocketpair ( unittest . TestCase ) : <EOL> def test_makefile ( self ) : <EOL> msg = b'<STR_LIT>' <EOL> x , y = socket . socketpair ( ) <EOL> x . sendall ( msg ) <EOL> x . close ( ) <EOL> with y . makefile ( '<STR_LIT:rb>' ) as f : <EOL> read = f . read ( ) <EOL> self . assertEqual ( msg , read ) <EOL> y . close ( ) <EOL> def test_fromfd ( self ) : <EOL> msg = b'<STR_LIT>' <EOL> x , y = socket . socketpair ( ) <EOL> xx = socket . fromfd ( x . fileno ( ) , x . family , socket . SOCK_STREAM ) <EOL> x . close ( ) <EOL> yy = socket . fromfd ( y . fileno ( ) , y . family , socket . SOCK_STREAM ) <EOL> y . close ( ) <EOL> xx . sendall ( msg ) <EOL> xx . close ( ) <EOL> with yy . makefile ( '<STR_LIT:rb>' ) as f : <EOL> read = f . read ( ) <EOL> self . assertEqual ( msg , read ) <EOL> yy . close ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
