#NEWLINE# def test_set_serializer( self ) : #NEWLINE# #INDENT# session = { #NEWLINE# #INDENT# 'session_id' : TotoSession . generate_id ( ) , #NEWLINE# 'expires' : ( time ( ) + 1000.0 ) , #NEWLINE# 'user_id' : 'test@toto.li' , #NEWLINE# #UNINDENT# } #NEWLINE# TotoSession . set_serializer ( pickle ) #NEWLINE# pickle_serialized = TotoSession . dumps ( session ) #NEWLINE# self . assertTrue ( isinstance ( pickle_serialized , str ) ) #NEWLINE# TotoSession . set_serializer ( json ) #NEWLINE# json_serialized = TotoSession . dumps ( session ) #NEWLINE# self . assertTrue ( isinstance ( json_serialized , str ) ) #NEWLINE# self . assertNotEqual ( pickle_serialized , json_serialized ) #NEWLINE# TotoSession . set_serializer ( pickle ) #NEWLINE# self . assertEqual ( TotoSession . loads ( pickle_serialized ) , session ) #NEWLINE# TotoSession . set_serializer ( json ) #NEWLINE# self . assertEqual ( TotoSession . loads ( json_serialized ) , session )