403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.41
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python313/Lib/test/test_pyrepl/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python313/Lib/test/test_pyrepl/__pycache__/test_pyrepl.cpython-313.opt-1.pyc
�

��i[���B�SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
JrJrJ
r
 SSKJrJr SSKJrJrJr SSKJrJr SSKJr SSKJrJr SS	KJrJrJrJ r J!r!J"r"J#r# SS
K$J%r% SSK&J'r'J(r(J)r) SSK&J"r* SSK+r+SSK-r."S
S\5r/"SS\5r0"SS\5r1"SS\\5r2"SS\5r3"SS\5r4\"\+S5"SS\/55r5\"\+S5\
"\RlRoS5=(d SS:HS5"SS \/555r8\"\RrS!:HS"5"S#S$\855r:"S%S&\5r;\"\RrS':HS(5"S)S*\55r<g!\,a Sr+GNf=f!\,a Sr.GNf=f)+�N)�TestCase�
skipUnless�skipIf)�Mock�patch)�force_not_colorized�make_clean_env�Py_DEBUG)�
SHORT_TIMEOUT�
STDLIB_DIR)�
import_module)�EnvironmentVarGuard�unlink�)�FakeConsole�ScreenEqualMixin�handle_all_events�handle_events_narrow_console�
more_lines�multiline_input�code_to_events)�Event)�ReadlineAlikeReader�ReadlineConfig�_ReadlineWrapper)rc��\rSrSrSSSSS.S\\\-S\S-S\\S-S\S-S	\S
\\\	44Sjjjr
S\\\-S\S-S\\S-S\S	\S
\\\	44SjrS
rg)�ReplTestCase�*NF)�cmdline_args�cwd�skip�
repl_input�envrr r!�returnc���SnUc [R"SS9nURnURXX4US9UbUR	5 $$!UbUR	5 ff=f)NT)�ignore_cleanup_errors)r#rr r!)�tempfile�TemporaryDirectory�name�	_run_repl�cleanup)�selfr"r#rr r!�temp_dirs       �1C:\Python313\\Lib\test\test_pyrepl\test_pyrepl.py�run_repl�ReplTestCase.run_repl+su�����;��2�2��N�H��-�-�C�	#��>�>��,�d�"���#�� � �"�$��x�#�� � �"�$�s�A�A"c��[R"5upg[RSS/nUcUR	S5 O)SU;a#[
RRUS5US'UbURU5 SSK	n	U	RU5n
SU
SU	R'SU
SU	R'U	RXyRU
5 [ R""UUUUUSSU(aUO[
R$S	9n[
R&"U5 [)U[*5(aS
RU5S
-n[
R,"XaR/S55 /n[0R0"U///[25S(ai[
R4"US5R7S5n
U
(dO�UR	U
5 [0R0"U///[25S(aMi[
R&"U5 UR;5 UR=S
SRU535 [
R&"U5 UR?[2S9nSRU5nU(aSU;aURCS5 X�4$![a GN�f=f![8a Mzf=f![ R@a# UR;5 UR?5nN�f=f)Nz-iz-uz-I�PYTHON_HISTORYz.regrtest_historyr�T)�stdin�stdout�stderrr �text�	close_fdsr#�
�utf-8iz'Timeout while waiting for output, got: �)�timeoutzcan't use pyreplzpyrepl not available)"�pty�openpty�sys�
executable�append�os�path�join�extend�termios�	tcgetattr�VREPRINT�VINTR�	tcsetattr�TCSANOW�ModuleNotFoundError�
subprocess�Popen�environ�close�
isinstance�list�write�encode�selectr�read�decode�OSError�kill�fail�wait�TimeoutExpired�skipTest)r,r"r#rr r!�	master_fd�slave_fd�cmdrF�	term_attr�process�output�data�	exit_codes               r.r*�ReplTestCase._run_repl@s~��"�k�k�m��	��~�~�t�T�*���;��J�J�t��
�S�
(�$&�G�G�L�L��6I�$J�C� �!��#��J�J�|�$�	D�� �)�)�(�3�I�-.�I�a�L��)�)�*�*+�I�a�L����'����h����C��"�"�����������
�
�	
��	������j�$�'�'����:�.��5�J�
����-�-�g�6�7����m�m�Y�K��R��?��B�
��w�w�y�$�/�6�6�w�?�����
�M�M�$���m�m�Y�K��R��?��B�B�
�H�H�Y���L�L�N��I�I�?������?P�Q�R�
�����	'����]��;�I��������&�&�0��M�M�0�1�� � ��]#�	��	��:�
��
���(�(�	'��L�L�N�����I�	'�s6�>J�-J0�K�
J-�,J-�0
J>�=J>�4K8�7K8��N)
�__name__�
__module__�__qualname__�__firstlineno__�strrR�dict�bool�tuple�intr/r*�__static_attributes__rg�r.rr*s��� �#�
*.���#��$�s�)�O�#��D�[�#�
�3�i�$�&�#��4�Z�
#��#�
�s�C�x��#�*C!��$�s�)�O�C!��D�[�	C!�
�3�i�$�&�C!��
C!��C!�
�s�C�x��C!rsrc�t�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrg)�TestCursorPosition�c�@�[U5n[SS9n[X#S9nU$�N��readline_completer��console�config�rrr�r,�eventsr|r}�readers     r.�prepare_reader�!TestCursorPosition.prepare_reader��%���f�%���4�8��$�W�D���
rsc
��Sn[R"[U5[SS[	S5S9/5n[U5up4UR
URS5 URRSS5 g)	N�def f():
  ...
�key�up�OA��evtrd�raw)rrrr�
�	itertools�chainrr�	bytearrayr�assertEqual�cxy�move_cursor�assert_called_once_with�r,�coder�r�r|s     r.�test_up_arrow_simple�'TestCursorPosition.test_up_arrow_simple�sr��
�	
�
����4� ��%�d�	�)�0D�E�
�
��,�F�3���������V�,����3�3�A�q�9rsc
��Sn[R"[U5[SS[	S5S9/5n[U5up4UR
URS5 URRSS5 g)	Nr�r��down�OBr�)r�rr�r�r�s     r.�test_down_arrow_end_of_input�/TestCursorPosition.test_down_arrow_end_of_input�sr��
�	
�
����4� ��%�f�)�I�2F�G�
�
��,�F�3���������V�,����3�3�A�q�9rsc
���[R"[S5[SS[	S5S9/5n[U5up#UR
URS5 URRSS5 g)	N�11+11r��left�ODr�)�rr�rr��r,r�r�r|s    r.�test_left_arrow_simple�)TestCursorPosition.test_left_arrow_simple�sf������7�#��%�f�)�I�2F�G�
�
��,�F�3���������V�,����3�3�A�q�9rsc
���[R"[S5[SS[	S5S9/5n[U5up#UR
URS5 URRSS5 g)	Nr�r��right�OCr�)�rr�rr�r�s    r.�test_right_arrow_end_of_line�/TestCursorPosition.test_right_arrow_end_of_line�sf������7�#��%�g�9�Y�3G�H�
�
��,�F�3���������V�,����3�3�A�q�9rsc���[R"[S55n[U5up#UR	UR
S5 UR	URS5 g)N�kr)rr�r�r�rrr��posr��r,r�r��_s    r.�%test_cursor_position_simple_character�8TestCursorPosition.test_cursor_position_simple_character�sK�������!4�5��%�f�-�	��������Q�'�	
������V�,rsc���[R"[S55n[U5up#UR	UR
S5 UR	URS5 g)N�樂r�r�rr�r�s    r.�+test_cursor_position_double_width_character�>TestCursorPosition.test_cursor_position_double_width_character�sK�������!6�7��%�f�-�	��������Q�'�	
������V�,rsc
���[R"[S5[SS[	S5S9/5n[U5up#UR
URS5 UR
URS5 g)Nr�r�r�r�r�r�rr�	r�r�rrr�rr�r�r�r�s    r.�5test_cursor_position_double_width_character_move_left�HTestCursorPosition.test_cursor_position_double_width_character_move_left�sd������5�!��%�f�)�I�2F�G�
�
��&�f�-�	��������Q�'�������V�,rsc��[R"[S5[SS[	S5S9[SS[	S5S9/5n[U5up#UR
URS5 UR
URS	5 g)
Nr�r�r�r�r�r�r�rr�r�r�s    r.�;test_cursor_position_double_width_character_move_left_right�NTestCursorPosition.test_cursor_position_double_width_character_move_left_right�sw������5�!��%�f�)�I�2F�G��%�g�9�Y�3G�H�
�
��&�f�-�	��������Q�'�	
������V�,rsc
�*�SnUS3n[R"[U5[SS[	S5S9/5n[U5upEUR
UR[U55 UR
UR[U5S45 g)N�for _ in _:� 
  ' 可口可乐; 可口可樂'r�r�r�r�r�
r�r�rrr�rr�r��lenr��r,�for_loopr�r�r�r�s      r.�4test_cursor_position_double_width_characters_move_up�GTestCursorPosition.test_cursor_position_double_width_characters_move_up�s��� ���Z�.�.�	
�����4� ��%�d�	�)�0D�E�
�
��&�f�-�	��	
������S��]�3�������c�(�m�Q�%7�8rsc�N�SnUS3n[R"[U5[SS[	S5S9[SS[	S5S9[SS	[	S
5S9/5n[U5upEUR
URS5 UR
URS5 g)
Nr�r�r�r�r�r�r�r�r�r��)�
rr�r�s      r.�9test_cursor_position_double_width_characters_move_up_down�LTestCursorPosition.test_cursor_position_double_width_characters_move_up_down
s��� ���Z�.�.�	
�����4� ��%�d�	�)�0D�E��%�f�)�I�2F�G��%�f�)�I�2F�G�
�
��&�f�-�	��
	
������R�(�������W�-rsc�@�[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S5S9/5n[U5up#UR
URS5 UR
URS5 g)Nu' 可口可乐; 可口可樂'r�r�r�r�r�)�rr�r�s    r.�?test_cursor_position_multiple_double_width_characters_move_left�RTestCursorPosition.test_cursor_position_multiple_double_width_characters_move_left(s�������:�;��%�f�)�I�2F�G��%�f�)�I�2F�G��%�f�)�I�2F�G�
�
��&�f�-�	��������R�(�	
������W�-rsc�x�SnSnUSUS3n[R"[U5[SS[	S5S9[SS[	S5S9/5n[U5upVUR
UR[U5[U5-S	-5 UR
UR[U5S	45 g)
Nr�z  hellor9z

  h
  helr�r�r�r�rr�)r,�
first_line�second_liner�r�r�r�s       r.�#test_cursor_position_move_up_to_eol�6TestCursorPosition.test_cursor_position_move_up_to_eol9s���"�
����l�"��m��
�	
�����4� ��%�d�	�)�0D�E��%�d�	�)�0D�E�
�
��&�f�-�	��	
����J�J��J��#�k�*:�:�Q�>�	
�	
������c�+�&6��%:�;rsc
��SnSU3n[R"[U5[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9/5n[U5upEUR
UR[U55 UR
UR[U5S	45 g)
Nz  helzfor _ in _:
  hello
  h
r�r�r�r�r�r��r�)r,�	last_liner�r�r�r�s      r.�%test_cursor_position_move_down_to_eol�8TestCursorPosition.test_cursor_position_move_down_to_eolZs����	�
��[�
�	
�����4� ��%�d�	�)�0D�E��%�d�	�)�0D�E��%�f�)�I�2F�G��%�f�)�I�2F�G�	
�
��&�f�-�	��	
������S��Y�/�������c�)�n�a�%8�9rsc�&�Sn[R"[U5S[SS[	S5S9/-[SS[	S5S9/5n[U5up4UR
URS	5 UR
URS
5 g)NuIdef foo():
  x = '可口可乐; 可口可樂'
  y = 'abckdfjskldfjslkdjf'�
r�r�r�r�r�r��)�rr��r,r�r�r�r�s     r.�1test_cursor_position_multiple_mixed_lines_move_up�DTestCursorPosition.test_cursor_position_multiple_mixed_lines_move_upzs���
*�	
�����4� ��%�E��I�i�4H�I�J�J�
�u�4�Y�y�-A�
B�C�
��&�f�-�	��	
������R�(�������W�-rsc
��Sn[R"[U5[SS[	S5S9/5n[U5up4UR
URS5 UR
URS5 g)Nzdef foo():
  hellor�r�r�r�r�)rr)	r�r�rrr�rr�r�r�r�s     r.�+test_cursor_position_after_wrap_and_move_up�>TestCursorPosition.test_cursor_position_after_wrap_and_move_up�sr��
�	
�����4� ��%�d�	�)�0D�E�
�
��1��8�	��	
������R�(�������V�,rsrgN)rirjrkrlr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrgrsr.ruru�sT���:�$:�$
:�
:�-�-�
-�
-�9�..�6.�"<�B:�@.�4-rsruc�D�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rg)�TestPyReplAutoindenti�c�@�[U5n[SS9n[X#S9nU$rxr~rs     r.r��#TestPyReplAutoindent.prepare_reader�r�rsc�|�SnSn[U5nURU5n[U5nURXR5 g)Nzdef f():
pass

zdef f():
    pass
    �rr�rr��r,�
input_code�output_coder�r�rcs      r.�test_auto_indent_default�-TestPyReplAutoindent.test_auto_indent_default�sJ��
�	�
�	� �
�+���$�$�V�,�� ��(������-rsc
���[R"[S5[SS[	S5S9/[S55nSnURU5n[
U5nURXB5 g)N�	def f():
r��	backspace�r��
  pass
pass

zdef f():
  pass
  pass
  �r�r�rrr�r�rr��r,r�r�r�rcs     r.�test_auto_indent_continuation�2TestPyReplAutoindent.test_auto_indent_continuation�su������<�(��%�k�y��7I�J�
�
��
�

��
�	��$�$�V�,�� ��(������-rsc
��[R"[S5[SS[	S5S9/[S5[S55nSnURU5n[
U5n[
U5nURXR5 g)	Nr�r�r�r�r�r�zdef g():
pass

zdef g():
  pass
  r�)r,r�r�r��output1�output2s      r.�test_auto_indent_prev_block�0TestPyReplAutoindent.test_auto_indent_prev_block�s�������<�(��%�k�y��7I�J�
�
��
�
��
�
��"
�	��$�$�V�,��!�&�)��!�&�)������.rsc���[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S	5S9/[S
5[SS[	S5S9[SS[	S5S9[SS[	S	5S9[SS[	S	5S9/5nS
nURU5n[
U5nURXB5 g)Nz
def f():
passr�r�r�r��sO5r9�
�passr�r�zdef f():
    pass
    pass
    r�r�s     r.�test_auto_indent_multiline�/TestPyReplAutoindent.test_auto_indent_multilines��������
��%�d�	�)�0D�E��%�f�)�I�2F�G��%�d�	�%�0@�A�
�
��
�
�%�f�)�I�2F�G��%�f�)�I�2F�G��%�d�	�%�0@�A��%�d�	�%�0@�A�

�
��4
�	��$�$�V�,�� ��(������-rsc�x�[S5nSnURU5n[U5nURXB5 g)Nzdef f():  # foo
pass

zdef f():  # foo
    pass
    r�r�s     r.�test_auto_indent_with_comment�2TestPyReplAutoindent.test_auto_indent_with_comment(�E���
�
��
�	��$�$�V�,�� ��(������-rsc�x�[S5nSnURU5n[U5nURXB5 g)Nzdef f():  ## foo
pass

zdef f():  ## foo
    pass
    r�r�s     r.�"test_auto_indent_with_multicomment�7TestPyReplAutoindent.test_auto_indent_with_multicomment:r
rsc�x�[S5nSnURU5n[U5nURXB5 g)Nz	pass  #:
zpass  #:r�r�s     r.� test_auto_indent_ignore_comments�5TestPyReplAutoindent.test_auto_indent_ignore_commentsLsC����
��

�	�
�$�$�V�,�� ��(������-rsrgN)
rirjrkrlr�r�r�r�rrrrrrrgrsr.r�r��s+���.�&.�6/�>%.�N.�$.�$
.rsr�c�b�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrg)�TestPyReplOutputi\c�N�[U5n[SS9n[X#S9nSUlU$)Nryr{F)rrr�can_colorizers     r.r��TestPyReplOutput.prepare_reader]s-���f�%���4�8��$�W�D��#����
rsc���[R"[RR	55(agURS5 g![anURSU35 SnAgSnAff=f)Nzstdin is not a ttyzstdin tty check failed: )rB�isattyr?r4�filenor]rX�r,�oses  r.�test_stdin_is_tty�"TestPyReplOutput.test_stdin_is_ttydsc��	0��y�y����)�)�+�,�,��-�

�M�M�.�/���	<��M�M�4�S�E�:�;�;��	<���7A
�
A5�A0�0A5c���[R"[RR	55(agURS5 g![anURSU35 SnAgSnAff=f)Nzstdout is not a ttyzstdout tty check failed: )rBrr?r5rr]rXrs  r.�test_stdout_is_tty�#TestPyReplOutput.test_stdout_is_ttynsc��	1��y�y����*�*�,�-�-��.�

�M�M�/�0���	=��M�M�5�c�U�;�<�<��	=�rc��UR[S55n[U5nURUS5 UR	USSS9 g)Nz1+1
�1+1T��clean)r�rrr��assert_screen_equal)r,r�rcs   r.�
test_basic�TestPyReplOutput.test_basicxsF���$�$�^�G�%<�=�� ��(�������'�� � ���d� �;rsc��UR[S55n[SSUS9nUR[	UR55[5 g)Nr9)�f_in�f_outr�)r�rr�assertIs�type�get_line_bufferrm)r,r��wrappers   r.� test_get_line_buffer_returns_str�1TestPyReplOutput.test_get_line_buffer_returns_strsA���$�$�^�D�%9�:��"��D��H���
�
�d�7�2�2�4�5�s�;rsc���[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S	5S9[SS
[	S5S9[SS[	S
5S9[SS[	S	5S9[SS[	S5S9[SS[	S5S9[SS[	S	5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9/5nURU5n[
U5nSnURX45 URX$SS9 [
U5nSnURX45 URX$SS9 g)Nzdef f():
...

r�r�r�r�r�r�r���g�gr�r��deleter�r��p�p�a�a�s�sr9rzdef f():
    ...
    Tr#zdef g():
    pass
    �	r�r�rrr�r�rr�r%)r,r�r�rc�expecteds     r.�test_multiline_edit�$TestPyReplOutput.test_multiline_edit�s�������.�/��%�d�	�)�0D�E��%�d�	�)�0D�E��%�f�)�I�2F�G��%�f�)�I�2F�G��%�f�)�I�2F�G��%�k�y��7I�J��%�c�y���?��%�f�)�I�2F�G��%�k�y��7I�J��%�h�I�g�4F�G��%�g�9�T�?�C��%�k�y��7I�J��%�c�y���?��%�c�y���?��%�c�y���?��%�c�y���?��%�d�	�%�0@�A��%�d�	�%�0@�A�%
�
��.�$�$�V�,�� ��(��,������*�� � ��� �>� ��(��-������*�� � ��� �>rsc��[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S5S9/5nURU5n[
U5nURUS5 URUSS	S
9 [
U5nURUS5 URUSS	S
9 [
U5nURUS5 URUSS	S
9 [
U5nURUS5 URUSS	S
9 g)N�1+1
2+2
r�r�r�r�r9rr"Tr#�2+2r<�r,r�r�rcs    r.�%test_history_navigation_with_up_arrow�6TestPyReplOutput.test_history_navigation_with_up_arrow�sQ������<�(��%�d�	�)�0D�E��%�d�	�%�0@�A��%�d�	�)�0D�E��%�d�	�)�0D�E��%�d�	�)�0D�E��%�d�	�%�0@�A�

�

���$�$�V�,�� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;rsc���Sn[[R"[U5[	SS[S5S9[	SS[S5S9[	SS[S5S9[	SS[S5S9[	SS[S5S9/55nUR
U5n[U5n[U5n[U5nSnURX5S	S
9 URXE5 g)Nz4def foo():
x = 1
y = 2
z = 3

def bar():
return 42

r�r�r�r�r9rz-def foo():
    x = 1
    y = 2
    z = 3
    Tr#)
rRr�r�rrr�r�rr%r�)r,r�r�r�rcr=s      r.�#test_history_with_multiline_entries�4TestPyReplOutput.test_history_with_multiline_entries�s���M���i�o�o��4� ��%�d�	�)�0D�E��%�d�	�)�0D�E��%�d�	�)�0D�E��%�d�	�%�0@�A��%�d�	�%�0@�A�
�	
�	���$�$�V�,�� ��(�� ��(�� ��(��F��� � ��� �>�����*rsc��[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S5S9[SS[	S	5S9[SS[	S	5S9/5nURU5n[
U5nURUS
5 URUS
SS9 g)
NrAr�r�r�r�r9rr�r�r"Tr#r<rCs    r.�'test_history_navigation_with_down_arrow�8TestPyReplOutput.test_history_navigation_with_down_arrow�s�������<�(��%�d�	�)�0D�E��%�d�	�)�0D�E��%�d�	�%�0@�A��%�f�)�I�2F�G��%�f�)�I�2F�G�
�	
���$�$�V�,�� ��(�������'�� � ���d� �;rsc
�n�[R"[S5[SS[	S5S9[SS[	S5S9[SS[	S	5S9[SS[	S	5S9/5nURU5n[
U5nURUS
5 URUS
SS9 [
U5nURUS
5 URUS
SS9 [
U5nURUS5 URUSSS9 [
U5nURUS
5 URUS
SS9 g)Nz1+1
2+2
3+3
r���r��1�1r9rr"Tr#rBz3+3r<rCs    r.�test_history_search�$TestPyReplOutput.test_history_search�s/������,�-��%�f�)�G�2D�E��%�c�y���?��%�d�	�%�0@�A��%�d�	�%�0@�A�	
�
���$�$�V�,�� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;� ��(�������'�� � ���d� �;rsc��[S5nURU5n[U5nURUS5 UR	USSS9 g)Nzc
zcTr#)rr�rr�r%rCs    r.�test_control_character�'TestPyReplOutput.test_control_charactersK���	�*���$�$�V�,�� ��(�������)�� � ���� �=rsc�8�[R"[S5[S5[SS[	S5S9[SS[	S5S9/5nURU5n[
U5 [
U5nURUS	5 URUS	S
S9 g)N�
import os
�impr��page up�[5~r�r9r�	import osTr#r<rCs    r.�test_history_search_backward�-TestPyReplOutput.test_history_search_backwards�������=�)��5�!��%�i�Y�z�5J�K��%�d�	�%�0@�A�
�
���$�$�V�,�����!��(�������-�� � ���D� �Arsc�$�[R"[S5[SS[	S5S9[SS[	S5S9/5nURU5n[
U5 [
U5nURUS5 URUSS	S
9 g)NrWr�rYrZr�r9rr[Tr#r<rCs    r.�"test_history_search_backward_empty�3TestPyReplOutput.test_history_search_backward_empty s�������=�)��%�i�Y�z�5J�K��%�d�	�%�0@�A�
�
���$�$�V�,�����!��(�������-�� � ���D� �ArsrgN)rirjrkrlr�rrr&r/r>rDrGrJrQrTr\r_rrrgrsr.rr\sF���0�1�<�<�
!?�F<�8+�,<�$<�4>�B�(Brsrc��\rSrSrSr\"SS5S5rSrSrSr	S	r
\"S
5\"S\RS9S
55r
Srg)�TestPyReplCompleteri4c��[U5n[5n[R"U5RUl[
X4S9nU$)Nr{)rr�rlcompleter�	Completer�completerzr)r,r��	namespacer|r}r�s      r.r��"TestPyReplCompleter.prepare_reader5s<���f�%���!��$/�$9�$9�)�$D�$M�$M��!�$�W�D���
rszrlcompleter._readline_availableFc��[S5nS[0nURX5n[X25nUR	US5 g)Nzos.getpid	
rBzos.getpid()�rrBr�rr��r,r�rgr�rcs     r.�test_simple_completion�*TestPyReplCompleter.test_simple_completion<s?����0���2�J�	��$�$�V�7�� ��3�������/rsc��[S5nS[0nURX5n[X25nUR	US5 g)Nzos.		O_AP	
rBzos.O_APPENDrjrks     r.�!test_completion_with_many_options�5TestPyReplCompleter.test_completion_with_many_optionsFsB�� � 1�2���2�J�	��$�$�V�7�� ��3�������/rsc�z�[S5n0nURX5n[X25nURUS5 g)Nz
os.geten	
zos.getenr�rks     r.�test_empty_namespace_completion�3TestPyReplCompleter.test_empty_namespace_completionTs;����/���	��$�$�V�7�� ��3�������,rsc�~�[S5nSS0nURX5n[X25nURUS5 g)Nzpy	
�pythonr�rks     r.� test_global_namespace_completion�4TestPyReplCompleter.test_global_namespace_completion\s@����)���t�$�	��$�$�V�7�� ��3�������*rsc�p�SnS[0n[R"[U5[	SS[S5S9[	SS[S5S9[	SS[S5S9/[S	55nUR
X2S
9n[XB5nURUS5 [XB5nURUS5 g
)z�Up arrow in the middle of unfinished tab completion when the menu is displayed
should work and trigger going back in history. Down arrow should subsequently
get us back to the incomplete command.zimport os
os.		rBr�r�r�r�r�r�r9)rgr[zos.N)	rBr�r�rrr�r�rr�)r,r�rgr�r�rcs      r.�'test_up_down_arrow_with_completion_menu�;TestPyReplCompleter.test_up_down_arrow_with_completion_menucs���$���2�J�	�����4� ��%�f�)�I�2F�G��%�d�	�)�0D�E��%�f�)�I�2F�G�
�

�4� �
���$�$�V�$�A�� ��3�������-�!��3�������'rsz,_pyrepl.readline._ReadlineWrapper.get_readerz
sys.stderr)�new_callablec��"SS5nU"5n[S5nSU0nURXV5nXrl[[SS5nURUS5 URUR
5S5 g)	Nc�$�\rSrSr\S5rSrg)�@TestPyReplCompleter.test_completion_with_warnings.<locals>.Dummyic�.�SSKnURS5 g)Nrz	warnings
)�warnings�warn)r,r�s  r.�	test_func�JTestPyReplCompleter.test_completion_with_warnings.<locals>.Dummy.test_func�s����
�
�l�+�rsrgN)rirjrkrl�propertyr�rrrgrsr.�Dummyr~s��
�
��
rsr�zdummy.test_func.	

�dummyz>>>z...zdummy.test_func.__r;)rr��return_value�readline_multiline_inputrr��getvalue)	r,�mock_stderr�mock_get_readerr�r�r�rgr�rcs	         r.�test_completion_with_warnings�1TestPyReplCompleter.test_completion_with_warnings|sx��	�	����� 8�9���e�$�	��$�$�V�7��'-�$�)�*�e�U�C������!5�6�����-�-�/��4rsrgN)rirjrkrlr�rrlrorrrvry�io�StringIOr�rrrgrsr.rbrb4sd����,�e�4�0�5�0�0�-�+�(�2�9�:�
�<�b�k�k�2�5�3�;�5rsrbc�>�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)�TestPasteEventi�c�@�[U5n[SS9n[X#S9nU$rxr~rs     r.r��TestPasteEvent.prepare_reader�r�rsc��Sn[R"[SS[S5S9/[	U5[SS[S5S9/[	S55nURU5n[
U5nURXA5 g)NzOdef a():
  for x in range(10):
    if x%2:
      print(x)
    else:
      pass
r��f3�ORr�r9�r�r�rr�rr�rr��r,r�r�r�rcs     r.�
test_paste�TestPasteEvent.test_paste�s���
�	
�����%�d�	�)�0D�E�
�
�4� ��%�d�	�)�0D�E�
�
�4� �	
���$�$�V�,�� ��(������&rsc��Sn[R"[SS[S5S9/[	U5[SS[S5S9/[	S55nURU5n[
U5nURXA5 g)Nzdef f():
  x = y
  
  y = z
r�r�r�r�r9r�r�s     r.�test_paste_mid_newlines�&TestPasteEvent.test_paste_mid_newlines�s���
�	
�����%�d�	�)�0D�E�
�
�4� ��%�d�	�)�0D�E�
�
�4� �	
���$�$�V�,�� ��(������&rsc�|�SnSn[U5nURU5n[U5nURXR5 g)Nzdef f():
x = y

y = z

zdef f():
    x = y
    r�)r,r�r=r�r�rcs      r.�)test_paste_mid_newlines_not_in_paste_mode�8TestPasteEvent.test_paste_mid_newlines_not_in_paste_mode�sJ��
�	
�
�	� ��%���$�$�V�,�� ��(������*rsc�|�SnSn[U5nURU5n[U5nURXR5 g)Nz:def a():
for x in range(10):
if x%2:
print(x)
else:
pass

zWdef a():
    for x in range(10):
        if x%2:
            print(x)
            else:r�r�s      r.�test_paste_not_in_paste_mode�+TestPasteEvent.test_paste_not_in_paste_mode�sJ��
#�	�
 �	� �
�+���$�$�V�,�� ��(������-rsc���SnSnSnSn[R"[U5[U5[U5[S55nURU5n[	U5nURXr5 g)z8Test that bracketed paste using [200~ and [201~ works.zQdef a():
  for x in range(10):

    if x%2:
      print(x)

    else:
      pass
�[200~�[201~r9N�r�r�rr�rr�)r,r�r��paste_start�	paste_endr�r�rcs        r.�test_bracketed_paste�#TestPasteEvent.test_bracketed_paste�sz��
�	�
�	�"���	�����;�'��:�&��9�%��4� �	
���$�$�V�,�� ��(������-rsc���SnSnSn[R"[U5[U5[U5[S55nURU5n[	U5nURXa5 g)N�oneliner�r�r9r�)r,r�r�r�r�r�rcs       r.� test_bracketed_paste_single_line�/TestPasteEvent.test_bracketed_paste_single_linesi���
�!���	�����;�'��:�&��9�%��4� �	
���$�$�V�,�� ��(������,rsrgN)rirjrkrlr�r�r�r�r�r�r�rrrgrsr.r�r��s&���'�4'�0+�*.�2%.�N-rsr�zrequires ptyc��\rSrSrSrSrg)�TestDumbTerminali0c�>�[RR5nURSS5 UR	SS05 URSUS9up#UR
US5 URSU5 URSU5 URS	U5 g)
N�
PYTHONSTARTUP�TERM�dumbzexit()
�r#rzwarning: can't use pyrepl�	Exception�	Traceback)	rBrO�copy�pop�updater/r��assertIn�assertNotIn)r,r#rcres    r.� test_dumb_terminal_exits_cleanly�1TestDumbTerminal.test_dumb_terminal_exits_cleanly2s����j�j�o�o���	�����&��
�
�F�F�#�$� �M�M�*�#�M�>�������A�&��
�
�1�6�:�����f�-�����f�-rsrgN)rirjrkrlr�rrrgrsr.r�r�0s��
.rsr�r�r�z!can't use pyrepl in dumb terminalc�6�\rSrSrSr\S5rS\S\\R-S\SS4S	jr
\S
S
S.Sj5rS
rSr
\S5r\S5rSr\S5rSr\S5r\S5rSr\S5rSrSrSr\"\S5S5r\S5rSrg)�TestMaini?c�~�[S[5S9nURUR5 UR	5 g)Nz
os.environ)�new)rr	�
addCleanup�stop�start)r,�patchers  r.�setUp�TestMain.setUpBs,����.�*:�;��������%��
�
�rsc��SnSnURSS/SS9up4URUS5 USU3U;nUS	U3U;nUS
U3U;nUSU3U;nURU=(d U=(d U=(d UU5 g)Nz"['__annotations__', '__builtins__'z4'__loader__', '__name__', '__package__', '__spec__']z
sorted(dir())�exit()T)r!rz
, '__doc__', z, '__doc__', '__file__', z', '__cached__', '__doc__', '__file__', z, '__cached__', '__doc__', )r/r��
assertTrue)	r,�pre�postrcre�case1�case2�case3�case4s	         r.�test_exposed_globals_in_repl�%TestMain.test_exposed_globals_in_replJs���2��E�� �M�M�?�H�*E�D�M�Q�������A�&��%�}�T�F�+�v�5���%�0���7�6�A���%�>�t�f�E��O���%�2�4�&�9�V�C������8��8�%�8�5�&�Ars�varr=�actualr$Nc���[U[R5(a4URUR	U5USUSUR
35 gUR
UUSUSUSUSU35 g)N�=z does not match z	expected z, got )rQ�re�Patternr��match�patternr�)r,r�r=r�s    r.�_assertMatchOK�TestMain._assertMatchOK_s{���h��
�
�+�+��O�O����v�&��%�q��� 0��1A�1A�0B�C�
�

������C�5��(��6�#��a��x�@�
rsF)�as_file�	as_modulec	���[5nSUS'[R"5n[R"U5S-nUR5 US-nUR
SSS9 UVs/sHnSU-S	-PM
 snS
/-n	U(aU(aURS5 OVU(aURU	[U5/USS
9up�O0U(aURU	SS/UUSS9up�OURS5 SSS5 URWS5 UR5Hyup�URX�S9 [R"SUS3W
5=n
(a URX�U
R!S5S9 OURUSU
<SU
35 SSS5 M{ UR#SW
5 UR#SU
5 gs snf!,(df   N�=f!,(df   M�=f)NrO�NO_COLOR�bluezcalx.pyzFOO = 42r:)�encodingz
print(f'^{z=}')r�z,as_file and as_module are mutually exclusiveT)rr#r!z-mz	blue.calx)rr#r r!z"Choose one of as_file or as_moduler)r�r=z\^z=(.+?)[\r\n]r)r�z= not found in output: z

r�r�)r	r'r(�pathlib�Path�mkdir�
write_textrZr/rmr��items�subTestr��searchr��groupr�)r,�expectationsr�r��	clean_env�tdr��modr��commandsrcrer=�ms              r.�_run_repl_globals_test�TestMain._run_repl_globals_testns���"�$�	� #�	�*��
�
(�
(�
*�b��<�<��#�f�,�D��J�J�L���"�C��N�N�:��N�8�7C��7C���s�"�V�+�|���
��H��9��	�	�H�I��$(�M�M��"%�c�(��!��	%2�%�!��	��$(�M�M��"&��!4�!���%2�%�!��	��	�	�>�?�5+�8	
����A�&�)�/�/�1�M�C����#��9��	�	�R��u�L�"9�6�B�B�1�B��'�'��a�g�g�a�j�'�I��I�I���%<�V�J�d�6�(�S�T�	:�9�2�	
����f�-�����f�-��A�+�
*��<:�9�s,�AG�(G�:A=G�5AG�G�
G�
G(	c�0�SSSS.nURUSS9 g)N�42�
'__main__'�None)�FOOri�__package__T)r�)r��r,r�s  r.�.test_inspect_keeps_globals_from_inspected_file�7TestMain.test_inspect_keeps_globals_from_inspected_file�s'���$�!�
��	
�#�#�L�$�#�?rsc�Z�SSS[R"S5S.nURUSS9 g)Nr�r�z'blue'z
^'.*calx.py'$)r�rir��__file__T)r�)r��compiler�r�s  r.�0test_inspect_keeps_globals_from_inspected_module�9TestMain.test_inspect_keeps_globals_from_inspected_module�s4���$�#��
�
�#3�4�	
��	
�#�#�L�D�#�Arsc��[RR5nSnURSS5 UR	X!SS9up4URUS5 UR
SU5 URSU5 URSU5 URS	U5 S
US'UR	X!S9up4URUS5 UR
SU5 URSU5 URSU5 URS	U5 SnS
US'UR	X!S9up4URUS5 UR
SU5 URSU5 URSU5 URS	U5 g)
NzRfrom test.support import initialized_with_pyrepl
initialized_with_pyrepl()
exit()
�PYTHON_BASIC_REPLT�r#r!r�True�Falser�r�rOr�z2import sys
print('_pyrepl' in sys.modules)
exit()
)rBrOr�r�r/r�r�r��r,r#r�rcres     r.�test_python_basic_repl�TestMain.test_python_basic_repl�sn���j�j�o�o�����	���#�T�*� �M�M�(�$�M�G�������A�&��
�
�f�f�%�����&�)�����f�-�����f�-�#&��� � �M�M�(�M�<�������A�&��
�
�g�v�&������(�����f�-�����f�-���$'��� � �M�M�(�M�<�������A�&��
�
�g�v�&������(�����f�-�����f�-rsc	��[RR[SS5nUR	[RRU5U5 [
U5nUR5nSSS5 [[S[[RW555nSHnURXC5 M g!,(df   NV=f)N�_pyreplz__main__.py)�?zunknown-filenamez<foo>z<...>)rBrCrDrr��exists�open�	readlinesrR�filter�maprm�strip�_test_no_pyrepl_source_in_exc)r,�pyrepl_main_file�fp�excluded_lines�filenames     r.�test_no_pyrepl_source_in_exc�%TestMain.test_no_pyrepl_source_in_exc�s����7�7�<�<�
�I�}�M����������'7�8�:J�K�
�"�
#�r��\�\�^�N�$��f�T�3�s�y�y�.�+I�J�K��C�H��.�.�x�H�D�	$�
#�s� C�
Cc	��[5o0RUS9 URS5 SU<S3nURXCS9upVUR	SU5 UR	SU5 UH,nURUS9 URXu5 SSS5 M. SSS5 SSS5 g!,(df   MP=f!,(df   N)=f!,(df   g=f)	N)rrzeval(compile('spam', z, 'eval'))
exit()
r�z!Traceback (most recent call last)z%NameError: name 'spam' is not defined)�line)rr��unsetr/r�r�)r,rrr#r�rcr�rs        r.r�&TestMain._test_no_pyrepl_source_in_exc�s���
 �
"�c�<�<��<�+J��I�I�)�*�/��|�<#�$�H��
�
�h�
�8�I�F��M�M�=�v�F��M�M�A�6�J�&���\�\�t�\�,��$�$�T�2�-�,�'�,K�
"�
"�-�,��,K�+J��
"�
"�s;�C�A"B=�<B+	�B=�C�+
B:
�5B=�=
C	�C�
Cc��^�[RR5nSnU4SjnURSS5 TR	X!SS9upEU"XE5 SUS'TR	X!S9upEU"XE5 g)Nz)import sys
sys.excepthook = 1
1/0
exit()
c��>�TRSU5 TRURS5S5 TRSU5 TRSU5 TRUS5 g)NzError in sys.excepthook:z'int' object is not callablerzOriginal exception was:zdivision by zeror)r�r��count)rc�exitcoder,s  �r.�check�CTestMain.test_bad_sys_excepthook_doesnt_crash_pyrepl.<locals>.check�sZ����M�M�4�f�=����V�\�\�*H�I�1�M��M�M�3�V�<��M�M�,�f�5����X�q�)rsrTrrOr�)rBrOr�r�r/)r,r#r�r#rcres`     r.�+test_bad_sys_excepthook_doesnt_crash_pyrepl�4TestMain.test_bad_sys_excepthook_doesnt_crash_pyrepl�ss����j�j�o�o�����
	*�	���#�T�*� �M�M�(�$�M�G���
�f� �#&��� � �M�M�(�M�<���
�f� rsc��[S5 [R"SS9nUR[UR
5 [RR5nUR
US'SnURSS5 URX2S9upEURUS5 URS	U5 URS
U5 UR[R"UR
5R!5R"S5 UR$R'5 UR)5 SUS'URX2S9upEURUS5 URS	U5 URS
U5 UR[R"UR
5R!5R"S5 g)N�readlineF)r5r2z123
spam
exit()
rr�r�123�spamrO)r
r'�NamedTemporaryFiler�rr)rBrOr�r�r/r�r��assertNotEqualr�r��stat�st_size�file�truncaterP)r,�hfiler#r�rcres      r.�test_not_wiping_history_file�%TestMain.test_not_wiping_history_file�sY���j�!��+�+�5�9�������
�
�+��j�j�o�o��� %�
�
����(�����#�T�*� �M�M�(�M�<�������A�&��
�
�e�V�$��
�
�f�f�%����G�L�L����4�9�9�;�C�C�Q�G�
�
�
����
���
�#&��� � �M�M�(�M�<�������A�&��
�
�e�V�$��
�
�f�f�%����G�L�L����4�9�9�;�C�C�Q�Grsc��[RR5nSnURX!SS9up4UR	SU5 UR	SU5 SnURX!S9up4UR	SU5 UR	SU5 g)	Nz
a b c
exit()
TrzSyntaxError: invalid syntaxz<python-input-0>z
 b
exit()
r�z#IndentationError: unexpected indent)rBrOr�r/r�rs     r.�%test_correct_filename_in_syntaxerrors�.TestMain.test_correct_filename_in_syntaxerrorss����j�j�o�o���$�� �M�M�(�$�M�G����
�
�3�V�<��
�
�(�&�1�!�� �M�M�(�M�<����
�
�;�V�D��
�
�(�&�1rsc	�J�[RR5nSH�nSU(aSOS-S-nSH�nU(aSUS'OURSS5 UR	UUS9 URX1S	S
9upVUR
SU5 U(a7URSU5 URS
U5 URSU5 O6UR
SU5 UR
S
U5 UR
SU5 SSS5 M� M� g!,(df   M�=f)N)TFzimport sys
zsys.tracebacklimit = 1
r;z;def x1(): 1/0

def x2(): x1()

def x3(): x2()

x3()
exit()
rOr)�set_tracebacklimit�
basic_replTrzin x1zin x2zin x3zin <module>)rBrOr�r�r�r/r�r�)r,r#r8r�r9rcres       r.�test_proper_tracebacklimit�#TestMain.test_proper_tracebacklimit%s���j�j�o�o���"/��&�7I�3�r�S�#�#�H�,�
��/2�C�+�,��G�G�/��6��\�\�5G�-7�"�9�(,�
�
�h�d�
�(S�%�F��M�M�'�6�2�)��(�(��&�9��(�(��&�9��(�(���?��
�
�g�v�6��
�
�g�v�6��
�
�m�V�<�9�9�,�#0�9�9�s
�)BD�
D"c�r�URS5upURUS5 URSU5 g)Nz	
exit()
r�	TypeError)r/r�r��r,rcres   r.�test_null_byte�TestMain.test_null_byteCs4�� �M�M�*:�;�������A�&�����f�-rsc��SnURU5up#URUS5 URSU5 URSU5 g)NzNimport runpy
runpy._run_module_code('blech', {0: '', 'bluch': ''}, '')
exit()
rz,all elements in 'candidates' must be strings�bluch)r/r�r�r�)r,r�rcres    r.�%test_non_string_suggestion_candidates�.TestMain.test_non_string_suggestion_candidatesHsK����!�M�M�(�3�������A�&����G��P��
�
�g�v�&rsc�~�[S5nURS:waURS5 [R"5n[
RR5nURUS'SUS'URSUS9upEURUS	5 URS
U5 UR[R"UR5R5R S	5 URS[R"UR5R#55 UR%SS5 URSUS9upEURUS	5 UR'S
[R"UR5R#55 SSS5 g!,(df   g=f)Nr(�editlinez*GNU readline is not affected by this issuer2rOrz
spam 
exit()
r�rzspam zspam\040zexit
z\040)r
�backendr]r'r+rBrOr�r)r/r�r�r,r�r�r-r.�	read_textr�r�)r,r(r1r#rcres      r.�test_readline_history_file�#TestMain.test_readline_history_fileSsI�� ��,�����z�)��M�M�F�G�
�
(�
(�
*�e��*�*�/�/�#�C�$)�J�J�C� �!�'*�C�#�$� $�
�
�.?�S�
� I��F����Y��*��M�M�'�6�*�������U�Z�Z� 8� =� =� ?� G� G��K��M�M�+�w�|�|�E�J�J�'?�'I�'I�'K�L��G�G�'��.� $�
�
�h�C�
� @��F����Y��*����W�g�l�l�5�:�:�&>�&H�&H�&J�K�+�
*�
*�s
�E#F.�.
F<c�R�UR/SQ5upURUS5 g)N)rM��exitr)r/r�r>s   r.�%test_keyboard_interrupt_after_isearch�.TestMain.test_keyboard_interrupt_after_isearchis$�� �M�M�*B�C�������A�&rsc���UR/SQ5up[R"S5nURSU5nUR	US5 URSU5 g)N)�help�qrMz"(\x1B(=|>|(\[)[0-?]*[ -\/]*[@-~]))r;rz>>> 
>>> >>>)r/r�r�subr�r�)r,rcre�ansi_escape�cleaned_outputs     r.�test_prompt_after_help�TestMain.test_prompt_after_helpmsW�� �M�M�*?�@����j�j�!F�G��$����V�4������A�&�
	
����.�9rsz--X showrefcount requires a Python debug buildc��[RR5nURSS5 UR	SS/US9up#[
R"SU5nUR[U5S5 SUS'UR	SS/US9up#[
R"SU5nUR[U5S5 g)	Nrr;z
1
1+2
exit()
z-Xshowrefcount)rr#z\[-?\d+ refs, \d+ blocks\]r�rO)	rBrOr�r�r/r��findallr�r�)r,r#rcr��matchess     r.�test_showrefcount�TestMain.test_showrefcountzs����j�j�o�o������#�R�(��M�M�"4�DT�CU�[^�M�_�	���*�*�:�F�C������W��q�)�#&��� ��M�M�"4�DT�CU�[^�M�_�	���*�*�:�F�C������W��q�)rsc�V�[RR5nURSS5 SUS'SnSn[b4URX!S9upEUR
US5 URX45 URU5upgUR
US5 SSKJ	n WR[RRS
S5S5 /n	URS5n
URS
5nU
(a4U	R[ R""U
R%S555 U(a4U	R[ R""UR%S555 U
(d)U(d"U	RS5 U	RS5 URS5nU(a8U	R[ R""UR%S55S-5 OU	RS5 URS5n
URS5nU
(a4U	R[ R""U
R%S555 U(a4U	R[ R""UR%S555 U
(d)U(d"U	RS5 U	RS5 URS5nURS5nU(a4U	R[ R""UR%S555 U(a4U	R[ R""UR%S555 U(d)U(d"U	RS5 U	RS5 U	RS5 U	RS5 U	RS5 [ R&"SR)U	55nUR+SU5nURUU5 g![a URS	5 GN�f=f)Nrr;rOz.print('Something pretty long', end='')
exit()
zSomething pretty long>>> exit()r�r)�cursesz(curses required for capability discoveryr�r�smkx�rmkx�asciiz
\x1b\[\?1[hl]z\x1b[=>]�ich1z	(?=[ -~])z\x1b\[(?:1)?@(?=[ -~])�civis�cnormz\x1b\[\?25[hl]z\x1b\[\?12[hl]�rmam�smamz
\x1b\[\?7lz
\x1b\[\?7hz\x1b\[\?2004[hl]z
\x1b\[\?[01]c�|)rBrOr�r��readline_moduler/r�r�rr^�ImportErrorr]�	setupterm�get�tigetstrrAr��escaperWrrDrS)r,r#r��expected_output_sequence�basic_output�basic_exit_codercrer^�
safe_patternsr_r`rbrcrdrerf�safe_escapesrUs                   r.�test_no_newline�TestMain.test_no_newline�s ���j�j�o�o������#�R�(�#&��� �E��#D� ��&�,0�M�M�(�M�,L�)�L����_�a�0��M�M�2�A� �M�M�(�3�������A�&�
	F�&�	����������3�Q�7��
����v�&�����v�&���� � ����4�;�;�w�+?�!@�A��� � ����4�;�;�w�+?�!@�A��D�� � �!1�2�� � ��-����v�&���� � ����4�;�;�w�+?�!@�<�!O�P�� � �!:�;�����(������(���� � ����5�<�<��+@�!A�B��� � ����5�<�<��+@�!A�B��U�� � �!2�3�� � �!2�3����v�&�����v�&���� � ����4�;�;�w�+?�!@�A��� � ����4�;�;�w�+?�!@�A��D�� � ��/�� � ��/�	���0�1����.�/����-�.��z�z�#�(�(�=�"9�:��%�)�)�"�f�5���
�
�.��?��k�	F��M�M�D�E�	F�s�P	�	P(�'P(rg)rirjrkrlr�rr�rmr�r�r�r�r�rr	rrr%r2r5r:r?rCrIrNrVrr
r[rsrrrgrsr.r�r�?sA����B��B�(
��
�&)�B�J�J�&6�
�@C�
�	
�
��>C�u�).��).�V@�B�� .�� .�D�
I��
I�
3��!��!�*H�6�	2��	2��=��=�:.�
�'��'�L�,'�:���I�J�
*�K�
*��L@��L@rsr��darwinz
macOS onlyc�0^�\rSrSrSrSU4SjjrSrU=r$)�TestMainAppleTerminali�z5Test the REPL with Apple Terminal's TERM_PROGRAM set.c�v>�Uc[RR5nSUS'[TU]"U4SU0UD6$)N�Apple_Terminal�TERM_PROGRAMr#)rBrOr��superr/)r,r"r#�kwargs�	__class__s    �r.r/�TestMainAppleTerminal.run_repl�s<����;��*�*�/�/�#�C�.��N���w��
�>��>�v�>�>rsrgrh)rirjrkrl�__doc__r/rr�
__classcell__)r}s@r.rwrw�s���?�?�?rsrwc�B�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rg)�TestPyReplCtrlDi�a�Test Ctrl+D behavior in _pyrepl to match old pre-3.13 REPL behavior.

Ctrl+D should:
- Exit on empty buffer (raises EOFError)
- Delete character when cursor is in middle of line
- Perform no operation when cursor is at end of line without newline
- Exit multiline mode when cursor is at end with trailing newline
- Run code up to that point when pressed on blank line with preceding lines
c�@�[U5n[SS9n[X#S9nU$rxr~rs     r.r��TestPyReplCtrlD.prepare_reader�r�rsc���[SS[S5S9/nURU5nUR[5 [U5 SSS5 g!,(df   g=f)z9Test that pressing Ctrl+D on empty line exits the programr���r�N)rr�r��assertRaises�EOFErrorr)r,r�r�s   r.�test_ctrl_d_empty_line�&TestPyReplCtrlD.test_ctrl_d_empty_line�sP��
�e�&�i��.@�A�
���$�$�V�,��
�
�
�x�
(��F�#�)�
(�
(�s�A�
Ac
��[R"[S5[SS[	S5S9/5n[U5up#UR
UR5 URSSRUR55 g)zVTest that pressing Ctrl+D in multiline mode with trailing newline exits multiline modezdef f():
    pass
r�r�r�r�r;N)r�r�rrr�rr��finishedr�rD�bufferr�s    r.�#test_ctrl_d_multiline_with_new_line�3TestPyReplCtrlD.test_ctrl_d_multiline_with_new_line�sk������1�2��%�f�)�G�2D�E�
�
��&�f�-�	��������(����/�������1G�Hrsc�>�[R"[S5[SS[	S5S9/S-[SS[	S5S9/5n[U5up#UR
UR5 URS	S
RUR55 g)zSTest that pressing Ctrl+D in multiline mode with cursor in middle deletes characterzdef f():
    hello worldr�r�r�r�r�r�r�zdef f():
    hello orldr;N�r�r�rrr�r�assertFalser�r�rDr�r�s    r.�$test_ctrl_d_multiline_middle_of_line�4TestPyReplCtrlD.test_ctrl_d_multiline_middle_of_lines�������6�7��%�f�)�I�2F�G�
��
��%�f�)�G�2D�E�
�
��&�f�-�	��������)����3�R�W�W�V�]�]�5K�Lrsc
��[R"[S5[SS[	S5S9/5n[U5up#UR
UR5 URSSRUR55 g)zNTest that pressing Ctrl+D at end of line without newline performs no operationzdef f():
    hellor�r�r�r�r;Nr�r�s    r.�,test_ctrl_d_multiline_end_of_line_no_newline�<TestPyReplCtrlD.test_ctrl_d_multiline_end_of_line_no_newlinesm������0�1��%�f�)�G�2D�E�
�
��&�f�-�	��������)����.�����
�
�0F�Grsc��[R"[S5[SS[	S5S9/[SS[	S5S9/5n[U5up#UR
SS	RUR55 g
)zGTest that pressing Ctrl+D in single line mode deletes current character�hellor�r�r�r�r�r��hellr;N�	r�r�rrr�rr�rDr�r�s    r.�&test_ctrl_d_single_line_middle_of_line�6TestPyReplCtrlD.test_ctrl_d_single_line_middle_of_line#sk������7�#�
�u�6�y��/C�
D�E�
�u�6�y��/A�
B�C�
��
&�f�-�	������������!7�8rsc
���[R"[S5[SS[	S5S9/5n[U5up#UR
SSRUR55 g)zLTest that pressing Ctrl+D at end of single line without newline does nothingr�r�r�r�r�r;Nr�r�s    r.�&test_ctrl_d_single_line_end_no_newline�6TestPyReplCtrlD.test_ctrl_d_single_line_end_no_newline-sW������7�#�
�u�6�y��/A�
B�C�
��&�f�-�	������"�'�'�&�-�-�"8�9rsrgN)
rirjrkrlrr�r�r�r�r�r�r�rrrgrsr.r�r��s-����$�
I�
M�
H�9�:rsr��win32zwindows console onlyc�*�\rSrSrSSjrSrSrSrg)�TestWindowsConsoleEolWrapi7c�0�SSKJn [RUR5nXlSUlS/Ul[5Ul	[5Ul
[5Ul[5Ul[5Ul
[5UlX24$)Nr)�windows_consoler�r;)rr��object�__new__�WindowsConsole�width�posxy�screenr�_hide_cursor�_show_cursor�
_erase_to_end�_move_relativer��_WindowsConsole__write)r,r��wcr|s    r.�_make_mock_console�,TestWindowsConsoleEolWrap._make_mock_console9sr��1��.�.��!2�!2�3���
���
�����#�v���#�v��� $����!%����"�f���)-���&��{�rsc��SnSnURUS9up4SnSnURRX2XVS5 URURSU45 g)Nr�r��r�r;�aaar�r�r��#_WindowsConsole__write_changed_liner�r��r,r��yr|r��old_line�new_lines       r.�#test_short_line_sets_posxy_normally�=TestWindowsConsoleEolWrap.test_short_line_sets_posxy_normallyKs`����
���-�-�E�-�:�������
���=�=���A�	
�	
�������A��/rsc��SnSnURUS9up4SnSU-nURRX2XVS5 URURUS-
U45 g)Nr�r�r�r;r8rrr�r�s       r.�#test_exact_width_line_does_not_wrap�=TestWindowsConsoleEolWrap.test_exact_width_line_does_not_wrapVsh����
���-�-�E�-�:�������;��
���=�=���A�	
�	
���������A��7rsrgN)�P)rirjrkrlr�r�r�rrrgrsr.r�r�7s���$	0�
8rsr�)=r�r�rBr�r�rdrUrMr?r'�unittestrrr�
unittest.mockrr�test.supportrr	r
rr�test.support.import_helperr
�test.support.os_helperrr�supportrrrrrrr�_pyrepl.consoler�_pyrepl.readlinerrrr�r=rir(rhrrur�rrbr�r�rOrkr��platformrwr�r�rgrsr.�<module>r�s���	��	��	��
��
��1�1�%�F�F�2�4�>����"�0�0�H����&�
Y!�8�Y!�xd-��d-�N	l.�8�l.�^UB�'��UB�pZ5�(�Z5�z\-�X�\-�~�C�� �.�|�.�!�.��C�� ��������	�	)�6�f�4�6Y�Z�T@�|�T@�[�!�T@�n�C�L�L�H�$�l�3�?�H�?�4�?�Q:�h�Q:�h�C�L�L�G�#�%;�<�(8��(8�=�(8��m0��
�C������O��s$�F�	F�F�F�F�F

Youez - 2016 - github.com/yon3zu
LinuXploit