+
    1*j	  c                  L   R t ^ RIHt ^ RIt^ RIHu Ht ^ RI	t	^ RI
t
^ RIHt ^ RIt]! ]4      P                  P                  R,          R,          R,          tR tR tR	 tR
 t]P*                  P-                  ]	P.                  P1                  R4      R8g  RR7      R 4       tR# )zTests for runtime/speech/stt.py.

Offline tests use FakeSTT only. The live model test is skipped unless
MENTORCORE_TEST_STT=1 is set (it requires model download).
)annotationsN)Pathfixturesaudiozfixture.wavc                    ^ RI Hp  V ! R4      pVP                  R	4      pRq2V8H  qD'       g   \        P                  ! R
V3RW#34      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;rCR# )    FakeSTTzvirtue is the highest goodpy0resultpy3zassert %(py5)spy5Nsd                                                                                                       ==)z%(py0)s == %(py3)s)runtime.speech.sttr   
transcribe
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation)r   sttr
   @py_assert2@py_assert1@py_format4@py_format6s          >/Users/jameslopez/projects/MentorCore/tests/speech/test_stt.py$test_fake_stt_returns_fixed_responser      s~    *
.
/C^^M*F111111116111111611116111111111111    c                    ^ RI Hp  V ! 4       pVP                  pRp^dqCV,          qR! V4      p\        V4      p^ qV8  q'       Egu   \        P
                  ! RV	3RWx34      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      R
\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p
RRV
/,          p\        \        P                  ! V4      4      hR;p;p;p;p;p;p;rR# )r   r       r	   lenpy1r   r   r   py7py10py12py15zassert %(py17)spy17N)>)z~%(py12)s
{%(py12)s = %(py0)s(%(py10)s
{%(py10)s = %(py3)s
{%(py3)s = %(py1)s.transcribe
}((%(py5)s * %(py7)s))
})
} > %(py15)s)r   r   r   r#   r   r   r   r   r   r   r   r   )r   r   r   @py_assert4@py_assert6@py_assert8@py_assert9@py_assert11@py_assert14@py_assert13@py_format16@py_format18s               r   test_fake_stt_default_responser4      s    *
)C~~1g11m1~m,13,-1111111-1111113111131111111s1111s111~111g111111,111-111111111111r    c                    ^ RI Hp Hp V ! 4       p\        W!4      q3'       Eg1   RRR\        P
                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P
                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P
                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR	\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR
pR
# )z+FakeSTT satisfies the STTProvider Protocol.)r   STTProvider5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}r	   
isinstancer$   r   py2r6   py4N)r   r   r6   r8   r   r   r   r   r   r   r   )r   r6   r   @py_assert3@py_format5s        r   test_stt_provider_protocolr=   $   s    7
)Cc''''''''':'''':'''''''c''''c''''''';'''';''''''''''r    c                    \         P                  q ! 4       q'       g   \        P                  ! R\          24      R,           RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR;r\        P                  ! \        \         4      R4      ;_uu_ 4       pVP                  q ! 4       p^qAV8H  qU'       g   \        P                  ! RV3RW34      RR	\        P
                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR	R\        P                  ! V 4      R\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p ;p;rTVP                  q ! 4       p^qAV8H  qU'       g   \        P                  ! RV3RW34      RR	\        P
                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR	R\        P                  ! V 4      R\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p ;p;rTVP!                  4       pVP#                  4       p	RRR4       X	X,          p
RqV8  q '       g   \        P                  ! RV 3RW34      RR\        P
                  ! 4       9   g   \        P                  ! V
4      '       d   \        P                  ! V
4      MRR\        P                  ! V4      /,          p\        P                  ! RV
R R24      R,           RV/,          p\        \        P                  ! V4      4      hR;rR#   + '       g   i     L; i)zDThe fixture WAV can be opened and has at least 1s of audio at 16kHz.zMissing fixture: zC
>assert %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.exists
}()
}r	   FIXTURE_WAVr9   r:   Nrbwfr%   zassert %(py9)spy9g      ?durationr   zFixture too short: z.2fsz
>assert %(py5)sr   r   )zK%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.getnchannels
}()
} == %(py7)s)zK%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.getsampwidth
}()
} == %(py7)s)>=)z%(py0)s >= %(py3)s)r?   existsr   _format_assertmsgr   r   r   r   r   r   waveopenstrgetnchannelsr   getsampwidthgetframerate
getnframes)r   r;   r<   rA   r,   @py_assert5@py_format8@py_format10rateframesrC   r   r   r   s                 r   test_fixture_wav_is_validrT   /   sF   BBBB#4[M!BBBBBBBB;BBBB;BBBBBBBBBBBB	3{#T	*	*b% %A%A%%%%% %%%%%%r%%%%r%%%%%% %%%A%%%%%%%%% %A%A%%%%% %%%%%%r%%%%r%%%%%% %%%A%%%%%%%% 	 
+
 }HAs?AAAA8AAAAAA8AAAA8AAAsAAAA1(3qAAAAAAAAA 
+	*s   A0P1
DP1B2P11Q	MENTORCORE_TEST_STT1z;Set MENTORCORE_TEST_STT=1 to run live STT (downloads model))reasonc                    ^ RI Hp  V ! \        \        4      4      p\	        V\        4      q"'       Eg9   RRR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR	\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR
pR
# )zTReal model: fixture WAV transcribed without crashing. WER not asserted (tone input).)transcribe_wav_filer7   r	   r8   r$   r
   r9   rJ   r:   N)r   rY   rJ   r?   r8   r   r   r   r   r   r   r   )rY   r
   r;   r<   s       r   test_transcribe_wav_file_liverZ   >   s     7 [!12Ffc""""""""":"""":"""""""f""""f"""""""c""""c""""""""""r    )__doc__
__future__r   builtinsr   _pytest.assertion.rewrite	assertionrewriter   osrH   pathlibr   pytest__file__parentr?   r   r4   r=   rT   markskipifenvirongetrZ    r    r   <module>rk      s    #   	   8n##**Z7'AMQ22(	B JJNN()S0H  #	#r    