+
    U*j  c                      R t ^ RIHt ^ RIt^ RIHu Ht ^ RI	H
t
 ^ RIt^ RIHtHt ]
! ]4      P                   P                   R,          R,          tR R ltR	 R
 ltR tR tR tR tR tR tR tR tR# )uO   TDD tests for compiler/stages/acquire.py — all offline via recorded fixtures.)annotationsN)Path)acquire_allextract_textfixtureshttpc                   V ^8  d   QhRR/# )   returnzhttpx.MockTransport )formats   "D/Users/jameslopez/projects/MentorCore/tests/compiler/test_acquire.py__annotate__r      s     ( (/ (    c                 :    R R lp \         P                  ! V 4      # )zAHTTPX mock transport that returns pre-recorded fixture responses.c                    V ^8  d   QhRRRR/# r   requestzhttpx.Requestr	   zhttpx.Responser
   )r   s   "r   r   (_fixture_transport.<locals>.__annotate__   s     J J J> Jr   c                d   \        V P                  4      pR V9   d;   RV9   d4   \        R,          P                  4       p\        P
                  ! ^VR7      # R V9   d;   RV9   d4   \        R,          P                  4       p\        P
                  ! ^VR7      # RV9   d;   RV9   d4   \        R,          P                  4       p\        P
                  ! ^VR7      # RV9   d;   RV9   d4   \        R	,          P                  4       p\        P
                  ! ^VR7      # \        P
                  ! R
RR7      # )zgutenberg.org2680gutenberg_2680.txtcontent55317zwikipedia.org/w/api.phpMarcus_Aureliuswikipedia_marcus_aurelius.jsonzwikiquote.orgwikiquote_marcus_aurelius.htmli  zNot found in fixture transport)text)strurlFIXTURES_HTTP
read_byteshttpxResponse)r   r   bodys   &  r   handler#_fixture_transport.<locals>.handler   s    '++c!fm!$88DDFD>>#t44c!gn!$88DDFD>>#t44$+0AS0H!$DDPPRD>>#t44c!&73&>!$DDPPRD>>#t44~~c(HIIr   )r"   MockTransport)r%   s    r   _fixture_transportr(      s    J& w''r   c                   V ^8  d   QhRR/# )r   r	   zhttpx.Clientr
   )r   s   "r   r   r   &   s     8 8l 8r   c                 @    \         P                  ! \        4       R 7      # )	transport)r"   Clientr(   r
   r   r   _mock_clientr.   &   s    <<"4"677r   c                (   R RRRRR/.p\        WR,          \        4       R7      pRq3V9   qD'       g   \        P                  ! RV3RW23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;r4VR,          pVP                  q! 4       q'       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      /,          p
\        \        P                  ! V
4      4      hR;rVP                  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      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;rRq7P                  q! 4       qV9   qD'       g   \        P                  ! RV3RW=34      R\        P                  ! V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;rR# )idmeditations-gutenberg
fetch_type	gutenberggutenberg_idx
  rawhttp_clientpy1py3resultassert %(py5)spy5NAassert %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.exists
}()
}py0pathpy2py4z.txtassert %(py7)spy7s   Marcus Aureliuszassert %(py9)spy9inz%(py1)s in %(py3)s==z.%(py2)s
{%(py2)s = %(py0)s.suffix
} == %(py5)s)zI%(py1)s in %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s.read_bytes
}()
})r   r.   
@pytest_ar_call_reprcompare	_saferepr@py_builtinslocals_should_repr_global_nameAssertionError_format_explanationexistssuffixr!   )tmp_pathsourcesr;   @py_assert0@py_assert2@py_format4@py_format6r@   @py_assert1@py_assert3@py_format5@py_assert4@py_format8@py_assert6@py_format10s   &              r   test_acquire_gutenbergrc   -   s    )+D	
G U"2OF",f,,,,,",,,",,,,,,f,,,,f,,,,,,,,)*D;;;==44;=;; & &     ;      4    4   ;   &        22!22!2222222222222222222222222!222222222r   c           	        R RRRRR/.p\        WR,          \        4       R7      pVR,          pVP                  qD! 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      /,          p\        \
        P                  ! V4      4      hR;rEVP                  pRqtV8H  qU'       g   \
        P                  ! RV3RWG3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;rWR# )r0   zwikipedia-marcus-aureliusr2   	wikipediawikipedia_titleMarcus Aureliusr6   r7   r>   r?   r@   rA   rB   Nz.jsonr=   rC   rD   rI   rK   r   r.   rT   rO   rP   rL   rQ   rN   rR   rS   rU   rM   
rV   rW   r;   r@   r\   r]   r^   r_   r[   r`   s
   &         r   test_acquire_wikipediarj   =   s    -+0	
G U"2OF-.D;;;==44;=;;!'!'!!!!!;!!!!!!4!!!!4!!!;!!!'!!!!!!!!r   c           	        R RRRRR/.p\        WR,          \        4       R7      pVR,          pVP                  qD! 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      /,          p\        \
        P                  ! V4      4      hR;rEVP                  pRqtV8H  qU'       g   \
        P                  ! RV3RWG3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;rWR# )r0   zwikiquote-marcus-aureliusr2   r   z-https://en.wikiquote.org/wiki/Marcus_Aureliusr6   r7   r>   r?   r@   rA   rB   Nz.htmlr=   rC   rD   rI   rK   rh   ri   s
   &         r   test_acquire_urlrl   K   s    -%B	
G U"2OF-.D;;;==44;=;;!'!'!!!!!;!!!!!!4!!!!4!!!;!!!'!!!!!!!!r   c           	        V R,          pRRRRRR/.p\        W!\        4       R7       \        P                  ! \        P                  ! R	 4      R
7      p\        W!VR7      pVR,          qUP
                  qf! 4       qw'       gk   RR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR;p;rgR# )z9Second call with same raw_dir should not hit the network.r6   r0   r1   r2   r3   r4   r5   r7   c                .    \         P                  ! R 4      # )i  )r"   r#   )rs   &r   <lambda>+test_acquire_skips_cached.<locals>.<lambda>f   s    5>>RUCVr   r+   zAassert %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.exists
}()
}r9   r:   r=   N)
r   r.   r"   r-   r'   rT   rL   rN   rR   rS   )	rV   raw_dirrW   failingr;   rX   rY   r_   r[   s	   &        r   test_acquire_skips_cachedrt   Y   s    G )+D	
G ln=llU%8%89V%WXGw?F)*31131333333*333133333333333r   c                  a
 V R,          pRRRRRR/.p\        W!\        4       R7       ^ .o
R	 V
3R
 llp\        P                  ! \        P                  ! V4      R7      p\        W!VRR7       S
^ ,          p^qeV8H  qw'       gy   \
        P                  ! RV3RWV34      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p	\        \
        P                  ! V	4      4      hR;p;rvR# )z2force=True must re-download even when file exists.r6   r0   r1   r2   r3   r4   r5   r7   c                    V ^8  d   QhRRRR/# r   r
   )r   s   "r   r   2test_acquire_force_refetches.<locals>.__annotate__x   s     1 1- 1N 1r   c                   < S^ ;;,          ^,          uu&   \         R,          P                  4       p\        P                  ! ^VR7      # )    r   r   )r    r!   r"   r#   )r   r$   
call_counts   & r   counting_handler6test_acquire_force_refetches.<locals>.counting_handlerx   s6    1 44@@B~~c400r   r+   T)r8   forcer9   rB   zassert %(py6)spy6NrI   )z%(py1)s == %(py4)s)
r   r.   r"   r-   r'   rL   rM   rN   rR   rS   )rV   rr   rW   r{   counting_clientrX   r]   rY   r^   @py_format7rz   s   &         @r   test_acquire_force_refetchesr   k   s    G )+D	
G ln=J1 1
 llU-@-@AQ-RSOoTJa=AA==Ar   c                ,   \         R ,          p\        VR4      pRq3V9   qD'       g   \        P                  ! RV3RW23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;r4\        V4      p^dqtV8  q'       Eg   \        P                  ! RV3RWG3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;rR# )r   r3   rg   r9   r:   r   r<   r=   Nr?   lenr~   assert %(py8)spy8rF   rH   >z/%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} > %(py6)sr    r   rL   rM   rN   rO   rP   rQ   rR   rS   r   rV   srcr   rX   rY   rZ   r[   @py_assert5r_   r   @py_format9s   &          r   test_extract_text_gutenbergr      s   
.
.C[)D$$$$$$$$$$$$$$$$$$$$$$$$$$$t9ss?933tt9sr   c                ,   \         R ,          p\        VR4      pRq3V9   qD'       g   \        P                  ! RV3RW23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;r4\        V4      p^2qtV8  q'       Eg   \        P                  ! RV3RWG3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;rR# )r   re   Stoicr9   r:   r   r<   r=   Nr?   r   r~   r   r   rF   rH   r   r   r   r   s   &          r   test_extract_text_wikipediar      s   
:
:C[)Dd?77ddt9rr>933tt9rr   c                *   \         R ,          p\        VR4      pRq2VJ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;rC\        V4      p^ qsV8  q'       Eg   \        P                  ! RV3RW73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;rR# )r   r   Nr?   r   r:   r<   r=   r   r9   r~   r   r   )is not)z%(py0)s is not %(py3)sr   r   )r    r   rL   rM   rO   rP   rQ   rN   rR   rS   r   )rV   r   r   rY   r\   rZ   r[   r   r_   r   r   s   &          r   test_extract_text_url_htmlr      s   
:
:CU#Dt444tt9qq=933tt9qr   )__doc__
__future__r   builtinsrO   _pytest.assertion.rewrite	assertionrewriterL   pathlibr   r"   compiler.stages.acquirer   r   __file__parentr    r(   r.   rc   rj   rl   rt   r   r   r   r   r
   r   r   <module>r      sj    U "      =X%%,,z9FB(283 ""4$4r   