#NEWLINE# def test_double_hub_add( self ) : #NEWLINE# #INDENT# hub = MagicMock ( spec_set = Hub ) #NEWLINE# hub2 = MagicMock ( spec_set = Hub ) #NEWLINE# self . data . register_to_hub ( hub ) #NEWLINE# with pytest . raises ( AttributeError ) as exc : #NEWLINE# #INDENT# self . data . __setattr__ ( 'hub' , hub2 ) #NEWLINE# #UNINDENT# assert ( hub2 . value . args [ 0 ] == 'Data has already been assigned to a different hub' )