#NEWLINE# def test_unsubscribe_does_not_receive_further_msgs( self ) : #NEWLINE# #INDENT# topic = '/test_unsubscribe_does_not_receive_further_msgs' #NEWLINE# msg_type = 'std_msgs/String' #NEWLINE# client = 'client_test_unsubscribe_does_not_receive_further_msgs' #NEWLINE# msg = String ( ) #NEWLINE# msg . data = 'dsajfadsufasdjf' #NEWLINE# pub = rospy . Publisher ( msg_type , String ) #NEWLINE# multi = MultiSubscriber ( topic , msg_type ) #NEWLINE# received = { #NEWLINE# #INDENT# 'count' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# def cb( msg ) : #NEWLINE# #INDENT# received [ 'count' ] = ( received [ 'count' ] + 1 ) #NEWLINE# #UNINDENT# multi . subscribe ( client , cb ) #NEWLINE# sleep ( 0.5 ) #NEWLINE# pub . publish ( msg ) #NEWLINE# sleep ( 0.5 ) #NEWLINE# self . assertEqual ( received [ 'count' ] , 1 ) #NEWLINE# multi . unsubscribe ( client ) #NEWLINE# sleep ( 0.5 ) #NEWLINE# pub . publish ( msg ) #NEWLINE# sleep ( 0.5 ) #NEWLINE# self . assertEqual ( received [ 'count' ] , 1 )