#NEWLINE# def test_revoking_schedule( self ) : #NEWLINE# #INDENT# global state #NEWLINE# dt = datetime . datetime ( 2011 , 1 , 1 ) #NEWLINE# dt2 = datetime . datetime ( 2037 , 1 , 1 ) #NEWLINE# r1 = modify_state . schedule ( args = ( 'k' , 'v' ) , eta = dt , convert_utc = False ) #NEWLINE# r2 = modify_state . schedule ( args = ( 'k2' , 'v2' ) , eta = dt , convert_utc = False ) #NEWLINE# r3 = modify_state . schedule ( args = ( 'k3' , 'v3' ) , eta = dt2 , convert_utc = False ) #NEWLINE# r4 = modify_state . schedule ( args = ( 'k4' , 'v4' ) , eta = dt2 , convert_utc = False ) #NEWLINE# r1 . revoke ( ) #NEWLINE# r3 . revoke ( ) #NEWLINE# self . assertTrue ( test_huey . is_revoked ( r1 . task ) ) #NEWLINE# self . assertFalse ( test_huey . is_revoked ( r2 . task ) ) #NEWLINE# self . assertTrue ( test_huey . is_revoked ( r3 . task ) ) #NEWLINE# self . assertFalse ( test_huey . is_revoked ( r4 . task ) ) #NEWLINE# expected = [ ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , 0 ) , ( { #NEWLINE# #INDENT# 'k2' : 'v2' , #NEWLINE# #UNINDENT# } , 0 ) , ( { #NEWLINE# #INDENT# 'k2' : 'v2' , #NEWLINE# #UNINDENT# } , 1 ) , ( { #NEWLINE# #INDENT# 'k2' : 'v2' , #NEWLINE# #UNINDENT# } , 2 ) ] #NEWLINE# for i in range ( 4 ) : #NEWLINE# #INDENT# ( curr_state , curr_sched ) = dt [ i ] #NEWLINE# task = test_huey . dequeue ( ) #NEWLINE# self . worker ( task ) #NEWLINE# self . assertEqual ( state , curr_state ) #NEWLINE# self . assertEqual ( test_huey . scheduled_count ( ) , curr_sched ) #NEWLINE# #UNINDENT# future = ( dt2 + datetime . timedelta ( seconds = 1 ) ) #NEWLINE# self . scheduler ( future ) #NEWLINE# self . assertEqual ( test_huey . scheduled_count ( ) , 0 ) #NEWLINE# for i in range ( 2 ) : #NEWLINE# #INDENT# task = test_huey . dequeue ( ) #NEWLINE# self . worker ( task , future ) #NEWLINE# #UNINDENT# self . assertEqual ( state , { #NEWLINE# #INDENT# 'k2' : 'v2' , #NEWLINE# 'k4' : 'v4' , #NEWLINE# #UNINDENT# } )