
    vKg-                       S SK Jr  S SKrS SKrS SKJr  S SKrS SKr " S S\5      r	SS jr
SS jrSS jr      SS	 jrSS
 jr      SS jr      SS jr      SS jr      SS jr      SS jr      SS jrSS jrg)    )annotationsN)Protocolc                  "    \ rS rSrSSS jjrSrg)RawInput   c                    g N )selfprompts     U/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/trio/_tests/test_repl.py__call__RawInput.__call__   s        r
   N r   strreturnr   )__name__
__module____qualname____firstlineno__r   __static_attributes__r
   r   r   r   r      s    44r   r   c                :   ^^ [        U 5      m/ mSSUU4S jjjnU$ )z
Pass in a list of strings.
Returns a callable that returns each string, each time its called
When there are not more strings to return, raise EOFError
c                h   > TR                  U 5         [        T5      $ ! [         a    [        S ef = fr	   )appendnextStopIterationEOFError)r   	cmds_iterpromptss    r   _raw_helper$build_raw_input.<locals>._raw_helper   s5    v	%	?" 	%$	%s   
 1r   r   )iter)cmdsr#   r!   r"   s     @@r   build_raw_inputr'      s%     T
IG% % r   c                     [        S/5      n U " 5       S:X  d   e[        R                  " [        5         U " 5         SSS5        g! , (       d  f       g= f)z"Quick test of our helper function.cmd1N)r'   pytestraisesr    )	raw_inputs    r   test_build_raw_inputr-   #   s;    )I;&   	x	  
!	 	 s   A
Ac                     S[         0$ )N__builtins__)r/   r
   r   r   build_localsr0   .   s    L))r   c                <  #    [         R                  R                  [        5       S9n[	        / SQ5      nUR                  USU5        [         R                  R                  U5      I Sh  vN   U R                  5       u  pEUR                  5       / SQ:X  d   eg N/7f)z
Run some basic commands through the interpreter while capturing stdout.
Ensure that the interpreted prints the expected results.
repl_locals)zx = 1zprint(f'{x=}')'hello'zdef func():z  print(x + 1)r   zfunc()zasync def afunc():z
  return 4r   zawait afunc()
import sysz"sys.stdout.write('hello stdout\n')r,   N)zx=1r4   24zhello stdout13)	trio_replTrioInteractiveConsoler0   r'   setattrrun_repl
readouterr
splitlinescapsysmonkeypatchconsoler,   outerrs         r   test_basic_interactionrF   2   s      jj//LN/KG	
I, i8
**

g
&&&  "HC>>QQQQ '   A(B*B+0Bc                N  #    [         R                  R                  [        5       S9n[	        S/5      nU R                  USU5        [        R                  " [        5         [         R                  R                  U5      I S h  vN   S S S 5        g  N! , (       d  f       g = f7f)Nr2   zraise SystemExitr,   )
r9   r:   r;   r0   r'   r<   r*   r+   
SystemExitr=   )rB   rC   r,   s      r   "test_system_exits_quit_interpreterrJ   W   s{     jj//LN/KG	
I
 i8	z	"jj!!'*** 
#	"* 
#	"s0   AB%!#BBB		B%B
B"B%c                <  #    [         R                  R                  [        5       S9n[	        / SQ5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;   d   eSU;  d   eSU;   d   eg  N/7f)Nr2   )	z#from trio._util import signal_raisez"import signal, trio, trio.lowlevelzasync def f():z`  trio.lowlevel.spawn_system_task(    trio.to_thread.run_sync,    signal_raise,signal.SIGINT,  )z  await trio.sleep_forever()z  print('should not see this')r   z	await f()z print('AFTER KeyboardInterrupt')r,   KeyboardInterruptshouldzAFTER KeyboardInterruptr9   r:   r;   r0   r'   r<   r=   r>   r@   s         r   test_KI_interruptsrO   c   s      jj//LN/KG	
I  i8
**

g
&&&  "HC#%%%3$+++	 'rG   c                  #    [         R                  R                  [        5       S9n[	        / SQ5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;   d   eg  N7f)Nr2   )r5   if sys.version_info < (3, 11):/  from exceptiongroup import BaseExceptionGroupr   z<raise BaseExceptionGroup('', [RuntimeError(), SystemExit()])!print('AFTER BaseExceptionGroup')r,   AFTER BaseExceptionGrouprN   r@   s         r   test_system_exits_in_exc_grouprU      s      jj//LN/KG	
	I i8
**

g
&&&  "HC &,,,	 '   A(B*B
+ Bc                  #    [         R                  R                  [        5       S9n[	        / SQ5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;   d   eg  N7f)Nr2   )r5   rQ   rR   r   zraise BaseExceptionGroup(z?  '', [BaseExceptionGroup('', [RuntimeError(), SystemExit()])])rS   r,   rT   rN   r@   s         r   %test_system_exits_in_nested_exc_grouprX      s      jj//LN/KG	

I i8
**

g
&&&  "HC &,,,	 'rV   c                <  #    [         R                  R                  [        5       S9n[	        SS/5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;  d   eSU;  d   eSU;   d   eg  N/7f)Nr2   zraise BaseExceptionprint('AFTER BaseException')r,   _threads.py_repl.pyAFTER BaseExceptionrN   r@   s         r   test_base_exception_capturedr^      s      jj//LN/KG "*	
I i8
**

g
&&&  "HC###S    C'''	 'rG   c                  #    [         R                  R                  [        5       S9n[	        SS/5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;   d   eg  N7f)Nr2   z&raise ExceptionGroup('', [KeyError()])zprint('AFTER ExceptionGroup')r,   zAFTER ExceptionGrouprN   r@   s         r   test_exc_group_capturedr`      s      jj//LN/KG 5+	
I i8
**

g
&&&  "HC!S((( 'rV   c                <  #    [         R                  R                  [        5       S9n[	        / SQ5      nUR                  USU5        [         R                  R                  U5      I S h  vN   U R                  5       u  pESU;  d   eSU;  d   eSU;   d   eg  N/7f)Nr2   )z-async def async_func_raises_base_exception():z  raise BaseExceptionr   z(await async_func_raises_base_exception()rZ   r,   r[   r\   r]   rN   r@   s         r   *test_base_exception_capture_from_coroutinerb      s      jj//LN/KG	

I i8
**

g
&&&  "HC###S    C'''	 'rG   c                 t    [         R                  " [        R                  SS/SS9n U R                  S:X  d   eg)zD
Basic smoke test when running via the package __main__ entrypoint.
z-mr9   s   exit())inputr   N)
subprocessrunsys
executable
returncode)repls    r   test_main_entrypointrk      s1     >>3>>48	JD??ar   )r&   z	list[str]r   r   )r   None)r   zdict[str, object])rA   zpytest.CaptureFixture[str]rB   pytest.MonkeyPatchr   rl   )rB   rm   r   rl   )
__future__r   re   rg   typingr   r*   
trio._replr9   r   r'   r-   r0   rF   rJ   rO   rU   rX   r^   r`   rb   rk   r
   r   r   <module>rq      s   "  
   5x 5&*"R&"R#"R 
"RJ	+,&,#, 
,:-&-#- 
-.-&-#- 
-0(&(#( 
(()&)#) 
)$(&(#( 
(0 r   