<s> import unittest <EOL> import markovify <EOL> import sys , os <EOL> import operator <EOL> def get_sorted ( chain_json ) : <EOL> return sorted ( chain_json , key = operator . itemgetter ( <NUM_LIT:0> ) ) <EOL> class MarkovifyTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> with open ( os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) ) as f : <EOL> self . sherlock = f . read ( ) <EOL> def test_simple ( self ) : <EOL> text_model = markovify . Text ( self . sherlock ) <EOL> combo = markovify . combine ( [ text_model , text_model ] , [ <NUM_LIT:0.5> , <NUM_LIT:0.5> ] ) <EOL> assert ( combo . chain . model == text_model . chain . model ) <EOL> def test_double_weighted ( self ) : <EOL> text_model = markovify . Text ( self . sherlock ) <EOL> combo = markovify . combine ( [ text_model , text_model ] ) <EOL> assert ( combo . chain . model != text_model . chain . model ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
