<s> '''<STR_LIT>''' <EOL> from __future__ import ( division , absolute_import , print_function , <EOL> unicode_literals ) <EOL> import unittest <EOL> import io <EOL> import pprint <EOL> from pysimsearch import freq_tools <EOL> from pysimsearch import doc_reader <EOL> class FreqToolsTest ( unittest . TestCase ) : <EOL> longMessage = True <EOL> def test_read_df ( self ) : <EOL> '''<STR_LIT>''' <EOL> df_dict = { '<STR_LIT:a>' : <NUM_LIT:5> , '<STR_LIT:b>' : <NUM_LIT:3> , '<STR_LIT:c>' : <NUM_LIT:1> } <EOL> df_file_str = '''<STR_LIT>''' <EOL> df_file = io . StringIO ( df_file_str ) <EOL> self . assertEqual ( freq_tools . read_df ( df_file ) , df_dict ) <EOL> def test_write_df ( self ) : <EOL> '''<STR_LIT>''' <EOL> df_dict = { '<STR_LIT:a>' : <NUM_LIT:5> , '<STR_LIT:b>' : <NUM_LIT:3> , '<STR_LIT:c>' : <NUM_LIT:1> } <EOL> df_file = io . StringIO ( ) <EOL> freq_tools . write_df ( df_dict , df_file ) <EOL> df_file . seek ( <NUM_LIT:0> ) <EOL> self . assertEqual ( freq_tools . read_df ( df_file ) , df_dict ) <EOL> def test_compute_df ( self ) : <EOL> doc1 = '<STR_LIT>' <EOL> doc2 = '<STR_LIT>' <EOL> doc3 = '<STR_LIT>' <EOL> df_dict = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:3> , '<STR_LIT:c>' : <NUM_LIT:2> , '<STR_LIT:d>' : <NUM_LIT:2> , '<STR_LIT:e>' : <NUM_LIT:2> , '<STR_LIT:f>' : <NUM_LIT:1> , '<STR_LIT:g>' : <NUM_LIT:1> , '<STR_LIT:h>' : <NUM_LIT:2> , <EOL> '<STR_LIT:i>' : <NUM_LIT:1> } <EOL> files = ( io . StringIO ( doc1 ) , io . StringIO ( doc2 ) , io . StringIO ( doc3 ) ) <EOL> self . assertEqual ( freq_tools . compute_df ( files ) , df_dict ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
