<s> import unittest <EOL> import imp <EOL> from client import stt , jasperpath <EOL> def cmuclmtk_installed ( ) : <EOL> try : <EOL> imp . find_module ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> return False <EOL> else : <EOL> return True <EOL> def pocketsphinx_installed ( ) : <EOL> try : <EOL> imp . find_module ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> return False <EOL> else : <EOL> return True <EOL> @ unittest . skipUnless ( cmuclmtk_installed ( ) , "<STR_LIT>" ) <EOL> @ unittest . skipUnless ( pocketsphinx_installed ( ) , "<STR_LIT>" ) <EOL> class TestSTT ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . jasper_clip = jasperpath . data ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . time_clip = jasperpath . data ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . passive_stt_engine = stt . PocketSphinxSTT . get_passive_instance ( ) <EOL> self . active_stt_engine = stt . PocketSphinxSTT . get_active_instance ( ) <EOL> def testTranscribeJasper ( self ) : <EOL> """<STR_LIT>""" <EOL> with open ( self . jasper_clip , mode = "<STR_LIT:rb>" ) as f : <EOL> transcription = self . passive_stt_engine . transcribe ( f ) <EOL> self . assertIn ( "<STR_LIT>" , transcription ) <EOL> def testTranscribe ( self ) : <EOL> """<STR_LIT>""" <EOL> with open ( self . time_clip , mode = "<STR_LIT:rb>" ) as f : <EOL> transcription = self . active_stt_engine . transcribe ( f ) <EOL> self . assertIn ( "<STR_LIT>" , transcription ) </s>
