#NEWLINE# def test_serialization( self ) : #NEWLINE# #INDENT# tf = TransferFunction ( ) #NEWLINE# tf . _min_range = 0.1 #NEWLINE# tf . _max_range = 2.0 #NEWLINE# tf . _pts . append ( ( 0.3 , 0.5 , ( 1.0 , 1.0 , 1.0 ) ) ) #NEWLINE# tf . _pts . append ( ( 0.6 , 0.7 , ( 1.0 , 0.5 , 1.0 ) ) ) #NEWLINE# tf . _pts . append ( ( 0.2 , 0.8 , ( 1.0 , 0.0 , 1.0 ) ) ) #NEWLINE# tf . _pts . sort ( ) #NEWLINE# ser1 = pickle . dumps ( tf ) . encode ( 'hex' ) #NEWLINE# ser2 = tf . serialize ( ) #NEWLINE# tf1 = TransferFunction . parse ( ser1 ) #NEWLINE# tf2 = TransferFunction . parse ( ser2 ) #NEWLINE# assert ( tf == tf1 ) #NEWLINE# assert ( tf == tf2 ) #NEWLINE# assert ( tf1 == tf2 )