#NEWLINE# def _test_heap_class( cls , * args , **kwargs ) : #NEWLINE# #INDENT# heap = cls ( * heap , ** kwargs ) #NEWLINE# for op in data : #NEWLINE# #INDENT# if ( op [ ( - 1 ) ] is not nx . NetworkXError ) : #NEWLINE# #INDENT# assert_equal ( op [ ( - 1 ) ] , getattr ( heap , op [ 0 ] ) ( * op [ 1 : ( - 1 ) ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert_raises ( op [ ( - 1 ) ] , getattr ( heap , op [ 0 ] ) , * op [ 1 : ( - 1 ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# for i in range ( 99 , ( - 1 ) , ( - 1 ) ) : #NEWLINE# #INDENT# assert_true ( heap . insert ( i , i ) ) #NEWLINE# #UNINDENT# for i in range ( 50 ) : #NEWLINE# #INDENT# assert_equal ( heap . pop ( ) , ( i , i ) ) #NEWLINE# #UNINDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# assert_equal ( heap . insert ( i , i ) , ( i < 50 ) ) #NEWLINE# #UNINDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# assert_false ( heap . insert ( i , ( i + 1 ) ) ) #NEWLINE# #UNINDENT# for i in range ( 50 ) : #NEWLINE# #INDENT# assert_equal ( heap . pop ( ) , ( i , i ) ) #NEWLINE# #UNINDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# assert_equal ( heap . insert ( i , ( i + 1 ) ) , ( i < 50 ) ) #NEWLINE# #UNINDENT# for i in range ( 49 ) : #NEWLINE# #INDENT# assert_equal ( heap . pop ( ) , ( i , ( i + 1 ) ) ) #NEWLINE# #UNINDENT# assert_equal ( sorted ( [ heap . pop ( ) , heap . pop ( ) ] ) , [ ( 49 , 50 ) , ( 50 , 50 ) ] ) #NEWLINE# for i in range ( 51 , 100 ) : #NEWLINE# #INDENT# assert_false ( heap . insert ( i , ( i + 1 ) , True ) ) #NEWLINE# #UNINDENT# for i in range ( 51 , 70 ) : #NEWLINE# #INDENT# assert_equal ( heap . pop ( ) , ( i , ( i + 1 ) ) ) #NEWLINE# #UNINDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# assert_true ( heap . insert ( i , i ) ) #NEWLINE# #UNINDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# assert_equal ( heap . pop ( ) , ( i , i ) ) #NEWLINE# #UNINDENT# assert_raises ( nx . NetworkXError , heap . pop )