#NEWLINE# def test_find_close_nodes_single_bucket( self ) : #NEWLINE# #INDENT# '\n        Ensures K number of closest nodes get returned.\n        ' #NEWLINE# parent_node_id = '0xdeadbeef' #NEWLINE# r = RoutingTable ( parent_node_id ) #NEWLINE# for i in range ( 40 ) : #NEWLINE# #INDENT# contact = PeerNode ( PUBLIC_KEY , ( '192.168.0.%d' % i ) , 9999 , self . version , 0 ) #NEWLINE# contact . network_id = hex ( i ) #NEWLINE# r . add_contact ( contact ) #NEWLINE# #UNINDENT# result = r . find_close_nodes ( hex ( 1 ) ) #NEWLINE# self . assertEqual ( constants . K , len ( result ) )