#NEWLINE# def testContextAffectsHash( self ) : #NEWLINE# #INDENT# n = GafferDispatch . PythonCommand ( ) #NEWLINE# n [ 'command' ] . setValue ( 'a = 10' ) #NEWLINE# with Gaffer . Context ( ) as c : #NEWLINE# #INDENT# h = n [ 'task' ] . hash ( ) #NEWLINE# c . setTime ( 2 ) #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h ) #NEWLINE# c . setTime ( 3 ) #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h ) #NEWLINE# c [ 'testInt' ] = 10 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h ) #NEWLINE# c [ 'testInt' ] = 20 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h ) #NEWLINE# #UNINDENT# n [ 'command' ] . setValue ( 'a = context.getFrame()' ) #NEWLINE# with Gaffer . Context ( ) as c : #NEWLINE# #INDENT# c . setTime ( 1 ) #NEWLINE# h1 = n [ 'task' ] . hash ( ) #NEWLINE# c . setTime ( 2 ) #NEWLINE# h2 = n [ 'task' ] . hash ( ) #NEWLINE# c . setTime ( 3 ) #NEWLINE# h3 = n [ 'task' ] . hash ( ) #NEWLINE# self . assertNotEqual ( h1 , h ) #NEWLINE# self . assertNotEqual ( h2 , h1 ) #NEWLINE# self . assertNotEqual ( h3 , h2 ) #NEWLINE# self . assertNotEqual ( h3 , h1 ) #NEWLINE# c [ 'testInt' ] = 10 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 ) #NEWLINE# c [ 'testInt' ] = 20 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 ) #NEWLINE# #UNINDENT# n [ 'command' ] . setValue ( "a = context['frame']" ) #NEWLINE# with Gaffer . Context ( ) as c : #NEWLINE# #INDENT# c . setTime ( 1 ) #NEWLINE# h1 = n [ 'task' ] . hash ( ) #NEWLINE# c . setTime ( 2 ) #NEWLINE# h2 = n [ 'task' ] . hash ( ) #NEWLINE# c . setTime ( 3 ) #NEWLINE# h3 = n [ 'task' ] . hash ( ) #NEWLINE# self . assertNotEqual ( h1 , h ) #NEWLINE# self . assertNotEqual ( h2 , h1 ) #NEWLINE# self . assertNotEqual ( h3 , h2 ) #NEWLINE# self . assertNotEqual ( h3 , h1 ) #NEWLINE# c [ 'testInt' ] = 10 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 ) #NEWLINE# c [ 'testInt' ] = 20 #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 ) #NEWLINE# #UNINDENT# n [ 'command' ] . setValue ( "a = context['testInt']" ) #NEWLINE# with Gaffer . Context ( ) as c : #NEWLINE# #INDENT# c [ 'testInt' ] = 1 #NEWLINE# h1 = n [ 'task' ] . hash ( ) #NEWLINE# c [ 'testInt' ] = 2 #NEWLINE# h2 = n [ 'task' ] . hash ( ) #NEWLINE# c [ 'testInt' ] = 3 #NEWLINE# h3 = n [ 'task' ] . hash ( ) #NEWLINE# self . assertNotEqual ( h2 , h1 ) #NEWLINE# self . assertNotEqual ( h3 , h2 ) #NEWLINE# self . assertNotEqual ( h3 , h1 ) #NEWLINE# c . setFrame ( 2 ) #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 ) #NEWLINE# c . setFrame ( 3 ) #NEWLINE# self . assertEqual ( n [ 'task' ] . hash ( ) , h3 )