+
    *j=  c                      R t ^ RIHt ^ RIt^ RIHu Ht ^ RI	H
t
 ^ RIHt ^ RIHtHtHtHt ]
 ! R R4      4       t ! R R	4      tR
 R ltR tR tR tR tR tR tR# )uN   Tests for compiler/stages/transcribe.py — offline via fake downloader/model.)annotationsN)	dataclass)Path)_resolve_audio_urlis_audio_sourcetranscribe_alltranscribe_sourcec                  D    ] tR t^t$ R]R&   R]R&   R]R&   RtR]R&   RtR	# )
_Segmentfloatstartendstrtext
SPEAKER_01speaker N)__name__
__module____qualname____firstlineno____annotations__r   __static_attributes__r       G/Users/jameslopez/projects/MentorCore/tests/compiler/test_transcribe.pyr	   r	      s    L	J
IGSr   r	   c                  .    ] tR t^tR R ltR R ltRtR# )
_FakeModelc                   V ^8  d   QhRR/# )   returnNoner   )formats   "r   __annotate___FakeModel.__annotate__   s      $ r   c                	    ^ V n         R# )    Ncalls)selfs   &r   __init___FakeModel.__init__   s	    
r   c                   V ^8  d   QhRR/# )r   audior   r   )r    s   "r   r!   r"      s     

 

 

r   c                	H   V ;P                   ^,          un         VP                  pRqC! V4      qU'       g   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      /,          p\        \        P                  ! V4      4      hR;p;rEVR	,          pR
qGV8H  q'       gy   \        P                  ! RV3RWt34      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p\        \        P                  ! V4      4      hR;p;r\        RRR4      \        RRR4      .R	R
/3# )   .m4azJassert %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.endswith
}(%(py4)s)
}py0r+   py2py4py6Nlanguageenpy1zassert %(py6)sg        g      ?zHello from the archive.g      ?g      @zThis is the second turn.==)z%(py1)s == %(py4)s)r&   endswith@py_builtinslocals
@pytest_ar_should_repr_global_name	_safereprAssertionError_format_explanation_call_reprcomparer	   )
r'   r+   kwargs@py_assert1@py_assert3@py_assert5@py_format7@py_assert0@py_assert2@py_format5s
   &&,       r   
transcribe_FakeModel.transcribe   s	   

a
~~%f%~f%%%%%%%%%u%%%%u%%%~%%%f%%%%%%%%%%j!)T)T)))))!)))!)))T)))))))) d$=>c#=> 
 	
r   r%   N)r   r   r   r   r(   rI   r   r   r   r   r   r      s    

 

r   r   c               $    V ^8  d   QhRRRRRR/# )r   srcdict	media_dirr   r   r   )r    s   "r   r!   r!   )   s!      $ 4 D r   c                r    VP                  R R R7       WR,           R2,          pVP                  R4       V# )T)parentsexist_okidr.   s
   fake audio)mkdirwrite_bytes)rL   rN   paths   && r   _fake_downloaderrV   )   s8    OOD4O0d)D))D]#Kr   c            	     B   R RRR/p \        V 4      q'       g   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R RRR
/p \        V 4      q'       g   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R RRR/p \        V 4      q'       g   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R RRRRR/p \        V 4      q'       * q3'       g   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	;p ;rR	# )rR   x
fetch_typeyoutubez,assert %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
}r/   r   r0   r1   Nrsstype	interviewurlarticlez0assert not %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
})r   r9   r:   r;   r<   r=   r>   r?   )rB   rC   rH   rD   @py_format6s        r   ?test_is_audio_source_matches_audio_fetch_types_and_source_typesra   0   s    #|Y?@??@@@@@@@@@?@@@@?@@@?@@@@@@@@@@ #|U;<?;<<<<<<<<<?<<<<?<<<;<<<<<<<<<< #v{;<?;<<<<<<<<<?<<<<?<<<;<<<<<<<<<< $c<	RSRSSSSSSSSSSSSSSSSSSRSSSSSSSSSSSr   c                   \        4       pR RRRRRRRRR	/p\        VV R
,          \        VR7      pR
q@V,          pRqeV,          qsV8H  q'       Eg   \        P                  ! RV3R W734      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      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;p;p;rgVP                  4       pRqV9   q'       g   \        P                  ! R!V3R"W34      R\        P                  ! V4      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR/,          pRRV/,          p\        \        P                  ! V4      4      hR;rRqV9   q'       g   \        P                  ! R!V3R"W34      R\        P                  ! V4      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR/,          pRRV/,          p\        \        P                  ! V4      4      hR;rVP                  p^pVV8H  qD'       g   \        P                  ! RV3R#VV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      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;ppR# )$rR   interview-1r\   r]   rY   rZ   r^   zhttps://example.com/watch?v=1r3   r4   raw
downloadermodelinterview-1.txtr/   resultr0   tmp_pathr1   py7zassert %(py10)spy10NzC[00:00:00.000 --> 00:00:01.250] SPEAKER_01: Hello from the archive.r5   py3
transcriptzassert %(py5)spy5zD[00:00:01.500 --> 00:00:03.000] SPEAKER_01: This is the second turn.rg   assert %(py7)sr6   )z*%(py0)s == ((%(py2)s / %(py4)s) / %(py7)s))in)z%(py1)s in %(py3)sz-%(py2)s
{%(py2)s = %(py0)s.calls
} == %(py5)s)r   r   rV   r;   r@   r9   r:   r<   r=   r>   r?   	read_textr&   )rj   rg   rL   ri   rC   rD   @py_assert6@py_assert8rB   @py_format9@py_format11rn   rF   rG   @py_format4r`   @py_assert4@py_format8s   &                 r   Btest_transcribe_source_downloads_and_writes_timestamped_transcriptr{   7   s:   LEmi.DC 5#	F !&9%9(99(99999999969999996999969999999X9999X999999(999999999!!#JP^T^^^^^^P^^^P^^^^^^T^^^^^T^^^^^^^^^Q_U______Q___Q______U_____U_________;;!;!;!55;!r   c                j   \        4       pV R ,          pVP                  4        VR,          pVP                  R4       RRRRRR/p\        WB\        VR	7      pWS8H  qf'       g   \
        P                  ! RV3RWS34      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/,          pRRV/,          p\        \
        P                  ! V4      4      hRpVP                  qf! 4       p	RqV
8H  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      R\
        P                  ! V	4      R\
        P                  ! V
4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;p	;rVP                  p^ qV8H  q'       g   \
        P                  ! RV	3RWn34      R
R\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rR# )rd   rh   zcached transcript
rR   rc   r\   r]   rY   rZ   re   r/   ri   r0   cachedzassert %(py4)sr1   Nrk   assert %(py9)spy9rg   ro   rp   r6   )z%(py0)s == %(py2)s)zH%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.read_text
}()
} == %(py7)srr   )r   rS   
write_textr   rV   r;   r@   r9   r:   r<   r=   r>   r?   rs   r&   )rj   rg   raw_dirr}   rL   ri   rB   @py_format3rH   rC   rt   rD   rz   @py_format10ry   r`   s   &               r   -test_transcribe_source_uses_cached_transcriptr   O   s   LEGMMO((F
+,\9
MCs8HPUVF666VV66!66!666666666666666666666666666!666666666;;!!;55;!r   c                   \        4       pR RRRRR/R RRRRRR	R
/.p\        VV R,          \        VR7      p\        V4      pR.qTV8H  qf'       Eg   \        P
                  ! RV3RWE3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      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;reVR,          qP                  qD! 4       qf'       gk   RR\        P                  ! V	4      R\        P                  ! V4      R\        P                  ! V4      /,          p
\        \        P                  ! V
4      4      hR;p	;rFVP                  p^qkV8H  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      R\        P                  ! V4      /,          p
RRV
/,          p\        \        P                  ! V4      4      hR;p;rR# )rR   z	article-1r\   r_   rY   r^   	podcast-1podcastr[   rss_urlzhttps://x.test/rssrd   re   r/   listr5   resultsrm   r2   zassert %(py8)spy8NzAassert %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.exists
}()
}ro   rg   r0   rp   rk   r6   )z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)srr   )r   r   rV   r   r;   r@   r9   r:   r<   r=   r>   r?   existsr&   )rj   rg   sourcesr   rG   rD   ry   rE   rv   rF   r`   rB   rC   rz   s   &             r   &test_transcribe_all_skips_text_sourcesr   ^   s   LE	{FI|UC	{FI|UIOcdG
 5#	G =)[M)M)))))=))))))4))))4))))))))))))))=)))M))))))));(&&(&(((((((((&((((((((((;;!!;55;!r   c                 $   R RRRRRRR/p \        V 4      pRpVV8H  q3'       g   \        P                  ! RV3RVV34      RR	\        P                  ! 4       9   g!   \        P
                  ! \         4      '       d   \        P                  ! \         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;r2R# )rR   r   rY   r[   r   zhttps://example.com/feed.xmlepisode_urlz#https://cdn.example.com/episode.mp3r/   r   r0   r1   rk   r~   r   Nr6   z0%(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)s)	r   r;   r@   r9   r:   r<   r=   r>   r?   )rB   rC   rt   rD   rz   r   s         r   *test_resolve_audio_url_prefers_episode_urlr   q   s    ke9D	
	

 1
	
 1	1
 
 
	
 1
 
 
 
 

 
 

 
 

 
 
	

 
 
 1
 
 
 
 
 
 
 
r   c                f   V R ,          pVP                  R4       RRRRR\        V4      /p\        V4      pRpVV8H  qU'       g   \        P                  ! RV3RVV34      RR	\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        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;rTR# )zfeed.xmlz<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <item>
      <title>Episode 1</title>
      <enclosure url="https://cdn.example.com/episode-1.mp3" type="audio/mpeg"/>
    </item>
  </channel>
</rss>
rR   r   rY   r[   r   z%https://cdn.example.com/episode-1.mp3r/   r   r0   r1   rk   r~   r   Nr6   r   )r   r   r   r;   r@   r9   r:   r<   r=   r>   r?   )rj   feedrB   rC   rt   rD   rz   r   s   &       r   )test_resolve_audio_url_from_rss_enclosurer      s2   j DOO		  ke3t9		
	 3		
 3	3	 	 		
 3	 	 	 	 		 	 		 	 		 	 		
	 	 	 3	 	 	 	 	 	 	 	r   )__doc__
__future__r   builtinsr9   _pytest.assertion.rewrite	assertionrewriter;   dataclassesr   pathlibr   compiler.stages.transcriber   r   r   r   r	   r   rV   ra   r{   r   r   r   r   r   r   r   <module>r      sg    T "    !        
 
"T0&r   