#NEWLINE# def test_sessions_json_dump( ) : #NEWLINE# #INDENT# ( bdb , tr ) = make_bdb_with_sessions ( ) #NEWLINE# _simple_bql_query ( bdb ) #NEWLINE# tr . stop_saving_sessions ( ) #NEWLINE# json_str = tr . dump_current_session_as_json ( ) #NEWLINE# session = json . loads ( json_str ) #NEWLINE# assert isinstance ( session , dict ) #NEWLINE# assert ( 'version' in session ) #NEWLINE# assert ( session [ 'version' ] == __version__ ) #NEWLINE# assert ( 'fields' in session ) #NEWLINE# assert isinstance ( session [ 'fields' ] , list ) #NEWLINE# nfields = len ( session [ 'fields' ] ) #NEWLINE# assert ( 'entries' in session ) #NEWLINE# assert isinstance ( session [ 'entries' ] , list ) #NEWLINE# entries = session [ 'entries' ] #NEWLINE# assert ( len ( entries ) == get_num_entries ( bdb . execute ) ) #NEWLINE# for entry in entries : #NEWLINE# #INDENT# assert ( len ( entry ) == nfields )