#NEWLINE# def test_add_contact_simple( self ) : #NEWLINE# #INDENT# '\n        Ensures that a newly discovered node in the network is added to the\n        correct bucket in the routing table.\n        ' #NEWLINE# parent_node_id = '0xdeadbeef' #NEWLINE# r = RoutingTable ( self ) #NEWLINE# contact1 = PeerNode ( PUBLIC_KEY , '192.168.0.1' , 9999 , 0 ) #NEWLINE# contact1 . network_id = hex ( 2 ) #NEWLINE# contact2 = PeerNode ( PUBLIC_KEY , '192.168.0.2' , 9999 , 0 ) #NEWLINE# contact2 . network_id = hex ( 4 ) #NEWLINE# r . add_contact ( contact1 ) #NEWLINE# self . assertEqual ( len ( r . _buckets [ 0 ] ) , 1 ) #NEWLINE# r . add_contact ( contact2 ) #NEWLINE# self . assertEqual ( len ( r . _buckets [ 0 ] ) , 2 )