#NEWLINE# def test_pubsub( self ) : #NEWLINE# #INDENT# ( s1 , s2 ) = self . create_bound_pair ( zmqpy . PUB , zmqpy . SUB ) #NEWLINE# s2 . setsockopt ( zmqpy . SUBSCRIBE , b'' ) #NEWLINE# wait ( ) #NEWLINE# poller = self . Poller ( ) #NEWLINE# poller . register ( s1 , ( zmqpy . POLLIN | zmqpy . POLLOUT ) ) #NEWLINE# poller . register ( s2 , zmqpy . POLLIN ) #NEWLINE# socks = dict ( poller . poll ( ) ) #NEWLINE# self . assertEquals ( self [ s1 ] , zmqpy . POLLOUT ) #NEWLINE# self . assertEquals ( ( s2 in socks ) , 0 ) #NEWLINE# s1 . send ( b'msg1' ) #NEWLINE# socks = dict ( poller . poll ( ) ) #NEWLINE# self . assertEquals ( socks [ s1 ] , zmqpy . POLLOUT ) #NEWLINE# wait ( ) #NEWLINE# socks = dict ( poller . poll ( ) ) #NEWLINE# self . assertEquals ( socks [ s2 ] , zmqpy . POLLIN ) #NEWLINE# s2 . recv ( ) #NEWLINE# socks = dict ( poller . poll ( ) ) #NEWLINE# self . assertEquals ( ( s2 in socks ) , 0 ) #NEWLINE# poller . unregister ( s1 ) #NEWLINE# poller . unregister ( s2 ) #NEWLINE# wait ( )