#NEWLINE# def test_indexed_set_mutate( ) : #NEWLINE# #INDENT# thou = IndexedSet ( range ( 1000 ) ) #NEWLINE# assert ( ( thou . pop ( ) , thou . pop ( ) ) == ( 999 , 998 ) ) #NEWLINE# assert ( ( thou . pop ( 499 ) , thou . pop ( 499 ) ) == ( 499 , 500 ) ) #NEWLINE# ref = [ 495 , 496 , 497 , 498 , 501 , 502 , 503 , 504 , 505 , 506 ] #NEWLINE# assert ( [ thou [ i ] for i in range ( 495 , 505 ) ] == ref ) #NEWLINE# assert ( len ( thou ) == 996 ) #NEWLINE# while ( len ( dead_idx_count ) > 600 ) : #NEWLINE# #INDENT# dead_idx_len = len ( thou . dead_indices ) #NEWLINE# dead_idx_count = thou . _dead_index_count #NEWLINE# thou . pop ( 0 ) #NEWLINE# new_dead_idx_len = len ( thou . dead_indices ) #NEWLINE# if ( new_dead_idx_len < dead_idx_len ) : #NEWLINE# #INDENT# assert ( dead_idx_count > 0 ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( len ( thou ) == 600 ) #NEWLINE# assert ( thou . _dead_index_count == 67 ) #NEWLINE# assert ( not any ( [ ( thou [ i ] is _MISSING ) for i in range ( len ( thou ) ) ] ) ) #NEWLINE# thou &= IndexedSet ( range ( 500 , 503 ) ) #NEWLINE# assert ( thou == IndexedSet ( [ 501 , 502 ] ) ) #NEWLINE# return