#NEWLINE# def testStatistics( self ) : #NEWLINE# #INDENT# m = Gaffer . PerformanceMonitor ( ) #NEWLINE# a = GafferTest . AddNode ( ) #NEWLINE# a [ 'op1' ] . setValue ( ( - 1001 ) ) #NEWLINE# a [ 'op2' ] . setValue ( ( - 1002 ) ) #NEWLINE# with m : #NEWLINE# #INDENT# self . assertEqual ( a [ 'sum' ] . getValue ( ) , ( - 2003 ) ) #NEWLINE# #UNINDENT# self . assertEqual ( ( m . plugStatistics ( a [ 'sum' ] ) . hashCount , m . plugStatistics ( a [ 'sum' ] ) . computeCount ) , ( 1 , 1 ) ) #NEWLINE# with m : #NEWLINE# #INDENT# self . assertEqual ( a [ 'sum' ] . getValue ( ) , ( - 2003 ) ) #NEWLINE# #UNINDENT# self . assertEqual ( ( m . plugStatistics ( a [ 'sum' ] ) . hashCount , m . plugStatistics ( a [ 'sum' ] ) . computeCount ) , ( 1 , 1 ) ) #NEWLINE# with m : #NEWLINE# #INDENT# with Gaffer . Context ( ) as c : #NEWLINE# #INDENT# c [ 'myVariable' ] = 1 #NEWLINE# self . assertEqual ( a [ 'sum' ] . getValue ( ) , ( - 2003 ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( ( m . plugStatistics ( a [ 'sum' ] ) . hashCount , m . plugStatistics ( a [ 'sum' ] ) . computeCount ) , ( 2 , 1 ) ) #NEWLINE# self . assertEqual ( len ( m . allStatistics ( ) ) , 1 ) #NEWLINE# self . assertEqual ( m . allStatistics ( ) [ a [ 'sum' ] ] , m . plugStatistics ( a [ 'sum' ] ) )