403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
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 :  /Python313/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

��i�8���SrSSKJrJr SSKrSSKrSSKrSSKrSSKrSSK	r	SSK
JrJrJ
r
Jr SSKJr SSSS	S
SS.r"S
S5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5rg)zfTesting `tabnanny` module.

Glossary:
    * errored    : Whitespace related problems present in file.
�)�TestCase�mockN)�captured_stderr�captured_stdout�
script_helper�findfile)�unlinkzCfruits = [
    "Apple",
    "Orange",
    "Banana",

print(fruits)
zLif True:
    print("hello")
  print("world")
else:
    print("else called")
zIif True:
 	print("hello")
	print("world")
else:
    print("else called")
zNif True:
    print("hello")
    print("world")
else:
    print("else called")
zGdef my_func():
	  print("hello world")
	  if True:
		print("If called")zLdef my_func():
		print("Hello world")
		if True:
	        print("If called"))�incomplete_expression�wrong_indented�nannynag_errored�
error_free�tab_space_errored_1�tab_space_errored_2c�.�\rSrSrSrSSjrSrSrSrg)	�TemporaryPyFile�?z+Create a temporary python source code file.Nc��XlX lg�N)�source_code�dir)�selfr�	directorys   �'C:\Python313\\Lib\test\test_tabnanny.py�__init__�TemporaryPyFile.__init__Bs
��&����c���[R"SURSSS9nURUR5 SSS5 WR
UlUR$!,(df   N+=f)N�wz.pyF)�moder�suffix�delete)�tempfile�NamedTemporaryFiler�writer�name�	file_path)r�fs  r�	__enter__�TemporaryPyFile.__enter__FsY��
�
(�
(��$�(�(�5��
�
�
�G�G�D�$�$�%�
�������~�~��
�
�s�A#�#
A1c�.�[UR5 gr)r	r&)r�exc_type�	exc_value�
exc_tracebacks    r�__exit__�TemporaryPyFile.__exit__Ns���t�~�~�r)rr&r)�N)	�__name__�
__module__�__qualname__�__firstlineno__�__doc__rr(r.�__static_attributes__�rrrr?s��5���rrc��\rSrSrSrSrSrg)�TestFormatWitnesses�Rz&Testing `tabnanny.format_witnesses()`.c���/SQnUHCup#URX#S9 UR[R"U5U5 SSS5 ME g!,(df   MW=f)z;Asserting formatter result by giving various input samples.))�Testzat tab sizes T, e, s, t)r0zat tab size )�tz
at tab size t)z  t  zat tab sizes  ,  , t,  ,  )�words�expectedN)�subTest�assertEqual�tabnanny�format_witnesses)r�testsr>r?s    r�test_format_witnesses�)TestFormatWitnesses.test_format_witnessesUsO��
�� %�O�E����E��=�� � ��!:�!:�5�!A�8�L�>�=� %�=�=�s�'A�
A	r7N)r1r2r3r4r5rEr6r7rrr9r9Rs��0�Mrr9c��\rSrSrSrSrSrg)�TestErrPrint�czTesting `tabnanny.errprint()`.c	��SS/S4S/S4/SQS4/S4/nUH�up#URX#S9 UR[5 [5n[R
"U6 S	S	S	5 UR
WR5U5 S	S	S	5 S	S	S	5 M� g	!,(df   NC=f!,(df   N,=f!,(df   M�=f)
zBAsserting result of `tabnanny.errprint()` by giving sample inputs.�first�secondz
first second
zfirst
)���z1 2 3
�
)�	argumentsr?N)r@�assertRaises�
SystemExitrrB�errprintrA�getvalue)rrD�argsr?�stderrs     r�
test_errprint�TestErrPrint.test_errprintfs����x�
 �"2�3��Y�	�"�
�	�"�
��J�	
��$�N�D������@��&�&�z�2�(�*�f� �)�)�4�0�+��$�$�V�_�_�%6��B�3�A�@�$�+�*��3�2��A�@�s;�B>�B-�B	�(B-�B>�
B*
�&B-�-
B;�7B>�>
C
	r7N)r1r2r3r4r5rXr6r7rrrHrHcs��(�CrrHc��\rSrSrSrSrg)�TestNannyNag�wc�z�[R"SSS5SSSS.4[R"SSS5SSSS.4/nUH�up#UR5nUR5nUR	5nURXCSS	9 UR
USU5 S
S
S
5 URXSSS9 UR
USU5 S
S
S
5 URXcS
S9 UR
US
U5 S
S
S
5 M� g
!,(df   Ns=f!,(df   NT=f!,(df   M�=f)z5Asserting behaviour of `tabnanny.NannyNag` exception.r�foo�bar)�lineno�msg�line��testmsg�testliner`)�line_numberr?Nra)rar?rb)rbr?)rB�NannyNag�
get_lineno�get_msg�get_liner@rA)rrD�nannyr?rfrarbs       r�test_all_methods�TestNannyNag.test_all_methodsxs2���!�!�!�U�E�2��U�E�:�
�
�!�!�!�Y�
�;��Y�
�C�
�	
�� %�O�E��*�*�,�K��-�-�/�C��>�>�#�D����'�8�2D���� � ��(�!3�[�A�����#����@�� � ��%��#�6�A����4�6�2B��C�� � ��&�!1�4�8�D�C� %����A�@��C�C�s$�D	�6D�&D+�	
D	�
D(	�+
D:	r7N)r1r2r3r4rlr6r7rrr[r[ws��9rr[c�^�\rSrSrSrSrSSjrSrSrSr	Sr
S	rS
rSr
SrS
rSrg)�	TestCheck�zTesting tabnanny.check().c�n�UR[[S[R5 S[lg)N�verboser)�
addCleanup�setattrrBrr)rs r�setUp�TestCheck.setUp�s"�������9�h�6F�6F�G���rc�@�[5n[5n[R"U5 SSS5 SSS5 UR	WR5U5 UR	WR5U5 g!,(df   NW=f!,(df   N`=f)a*Common verification for tabnanny.check().

Use this method to assert expected values of `stdout` and `stderr` after
running tabnanny.check() on given `dir` or `file` path. Because
tabnanny.check() captures exceptions and writes to `stdout` and
`stderr`, asserting standard outputs is the only way.
N)rrrB�checkrArU)r�dir_or_file�out�err�stdoutrWs      r�verify_tabnanny_check�TestCheck.verify_tabnanny_check�se���
�&�/�*;�v��N�N�;�'�+<�
�������*�C�0�������*�C�0�+<�*;��
�
�s!�B�A>�B�>
B	�B�
Bc�~�[[S5nURU5 SSS5 g!,(df   g=f)z-A python source code file without any errors.r
N�r�SOURCE_CODESr}�rr&s  r�test_correct_file�TestCheck.test_correct_file�s+��
�\�,�7�
8�I��&�&�y�1�9�
8�
8���.�
<c
��[R"5nU<S3/n[[SUS9n[[SUS9nUoTnXV4HnUR	U<S35 M S[
l[5n[5n	[
R"U5 SSS5 SSS5 WR5nUH,n
URU
S9 URX�5 SSS5 M. URW	R5S5 SSS5 SSS5 SSS5 g!,(df   N�=f!,(df   N�=f!,(df   M�=f!,(df   NS=f!,(df   N\=f!,(df   g=f)	z�Directory containing few error free python source code files.

Because order of files returned by `os.lsdir()` is not fixed, verify the
existence of each output lines at `stdout` using `in` operator.
`verbose` mode of `tabnanny.verbose` asserts `stdout`.
z: listing directory
r
�rz: Clean bill of health.
rMN)rbr0)r"�TemporaryDirectoryrr��appendrBrrrrrxrUr@�assertInrA)r�tmp_dir�lines�file1�file2�
file1_path�
file2_pathr&r|rWrbs           r�test_correct_directory_verbose�(TestCheck.test_correct_directory_verbose�s,���
(�
(�
*�g��{�"7�8�:�E�#�L��$>�'�R�E�#�L��$>�'�R�E��*�e�z�",�!9�I��L�L�I�=�0I�!J�K�":�$%�� �$�&�&�/�2C�v��N�N�7�+�3D�&����*��!�D����4��0��
�
�d�3�1�0�"�� � ����!2�B�7�',��	+�
*�3D�2C��&�&��1�0��',�e�����	+�
*�s��,E<�E+�5E�9D7	�D&�D7	�#,E�E�!,E�
E+�E<�&
D4�0D7	�7
E
�E�
E�E�
E(�$E+�+
E9	�5E<�<
F
c���[R"5n[[SUS9 UR	U5 SSS5 SSS5 g!,(df   N=f!,(df   g=f)zADirectory which contains few error free python source code files.r
r�N)r"r�rr�r})rr�s  r�test_correct_directory� TestCheck.test_correct_directory�sK��
�
(�
(�
*�g� ��l�!;�w�O��*�*�7�3�P�+�
*�O�O��+�
*�s!�A�A�A�
A	�A�
A*c���[[S5nSnU<SU3nUR[5 UR	XS9 SSS5 SSS5 g!,(df   N=f!,(df   g=f)zBA python source code file eligible for raising `IndentationError`.r�Iunindent does not match any outer indentation level (<tokenize>, line 3)
�: Indentation Error: �r{N�rr�rRrSr}�rr&r{s   r�test_when_wrong_indented�"TestCheck.test_when_wrong_indented�sh��
�\�*:�;�
<�	�*�C��M�!6�s�e�<�C��"�"�:�.��*�*�9�*�>�/�	=�
<�/�.��	=�
<��"� A%�A�A%�
A"	�A%�%
A3c���[[S5nSnU<SU3nUR[5 UR	XS9 SSS5 SSS5 g!,(df   N=f!,(df   g=f)zEA python source code file eligible for raising 'tokenize.TokenError'.r
z(('EOF in multi-line statement', (7, 0))
z: Token Error: r�Nr�r�s   r�test_when_tokenize_tokenerror�'TestCheck.test_when_tokenize_tokenerror�sg��
�\�*A�B�
C�y�=�C��M����6�C��"�"�:�.��*�*�9�*�>�/�D�
C�/�.��D�
C�r�c��[[S5nU<S3nUS-
nUS-
nS[lUR	XS9 SSS5 g!,(df   g=f)z�A python source code file eligible for raising `tabnanny.NannyNag`.

Tests will assert `stdout` after activating `tabnanny.verbose` mode.
rz': *** Line 3: trouble in tab city! ***
z#offending line: '\tprint("world")'
z3inconsistent use of tabs and spaces in indentation
rM�rzN)rr�rBrrr}�rr&rzs   r� test_when_nannynag_error_verbose�*TestCheck.test_when_nannynag_error_verbose�s\��
�\�*<�=�
>�)��M�!I�J�C��<�<�C��I�I�C� �H���&�&�y�&�:�
?�
>�
>�s�+A�
Ac��[[S5nUS3nURXS9 SSS5 g!,(df   g=f)zCA python source code file eligible for raising `tabnanny.NannyNag`.rz 3 '\tprint("world")'
r�Nr�r�s   r�test_when_nannynag_error�"TestCheck.test_when_nannynag_error�s<��
�\�*<�=�
>�)��K�9�:�C��&�&�y�&�:�?�
>�
>�s�1�
?c��SnU<S[RS[R"[R5SU<S3nUR	[
5 UR
XS9 SSS5 g!,(df   g=f)z6A python file which does not exist actually in system.z
no_file.pyz: I/O Error: [Errno z] z: rPr�N)�errno�ENOENT�os�strerrorrRrSr})r�pathr{s   r�test_when_no_file�TestCheck.test_when_no_file�sf������-�e�l�l�^�2����U�\�\�*�+�2�d�X�R�9��
�
�
�z�
*��&�&�t�&�5�+�
*�
*�s�A1�1
A?c	��[R"5n[[SUS9n[[SUS9nUoCnSnU<SU3nUR	[
5 UR
XS9 SSS5 SSS5 SSS5 SSS5 g!,(df   N'=f!,(df   N0=f!,(df   N9=f!,(df   g=f)z?Directory containing wrongly indented python source code files.rr�r
r�r�r�N)r"r�rr�rRrSr})rr��
error_file�	code_file�e_file�c_filer{s       r�test_errored_directory� TestCheck.test_errored_directory�s���
�
(�
(�
*�g�(��-�.�'��J�(��\�*�g��I��v�y�F�6���
�"7��u�=���&�&�z�2��.�.�w�.�@�3�	(1��+�
*�3�2��	(1�y�����+�
*�sQ�%C�B0� B�B	�-B�5B0�=C�
B
�B�
B-�)B0�0
B>	�:C�
Cr7N)r0r0)r1r2r3r4r5rur}r�r�r�r�r�r�r�r�r�r6r7rrroro�s=��#��1�2�
8�04�?�?�;�;�6�Arroc�N�\rSrSrSr\R"S5S5rSrSr	g)�TestProcessTokensiz$Testing `tabnanny.process_tokens()`.ztabnanny.NannyNagc�D�[[S5n[U5n[R"[
R"UR55 SSS5 URUR5 SSS5 g!,(df   N2=f!,(df   g=f)z=A python source code without any whitespace related problems.r
N)
rr��openrB�process_tokens�tokenize�generate_tokens�readline�assertFalse�called)r�MockNannyNagr&r's    r�test_with_correct_code�(TestProcessTokens.test_with_correct_code	si���\�,�7�
8�I��i��A��'�'��(@�(@����(L�M�!����\�0�0�1�9�
8� ���9�
8�s"�B�5B�#B�
B	�
B�
Bc
���SH�nURUS9 [[U5n[U5n[R
"UR5nUR[R5 [R"U5 SSS5 SSS5 SSS5 SSS5 M� g!,(df   N+=f!,(df   N4=f!,(df   N==f!,(df   M�=f)z>A python source code with whitespace related sampled problems.)rr)�keyN)r@rr�r�r�r�r�rRrBrgr�)rr�r&r'�tokenss     r�test_with_errored_codes_samples�1TestProcessTokens.test_with_errored_codes_sampless���B�C����#��&�$�\�#�%6�7�9��i��A�!)�!9�!9�!�*�*�!E��!�.�.�x�/@�/@�A�$�3�3�F�;�B�)�8�'�&�B�
B�A��)���8�7��'�&�sR�C#�C�AC	�4B0�C	�C�C#�0
B>�:C	�
C
�C�
C �C#�#
C2	r7N)
r1r2r3r4r5r�patchr�r�r6r7rrr�r�s&��.�	�Z�Z�#�$�2�%�2�<rr�c�P�\rSrSrSrSSSSS.SjrSrSrS	rS
r	Sr
SrS
rg)�TestCommandLinei$z+Tests command line interface of `tabnanny`.r0F)r|rW�partial�expect_failurec��U(a[R"SS/UQ76upgnO"SS/UQ76upgn[R"U5n[R"U5nU(a`X4X(44HUup�U
R5nU	R5H,nUR
X�S9 URX�5 SSS5 M. MW gURUR5UR55 URUR5UR55 g!,(df   M�=f)zBCommon function to assert the behaviour of command line interface.z-mrB)�std�outputN)	r�assert_python_failure�assert_python_okr��fsdecode�
splitlinesr@r��assertListEqual)
rr|rWr�r�rV�_rzr{r�r��_output�_stds
             r�validate_cmd�TestCommandLine.validate_cmd's���'�=�=�d�J�V�QU�V�K�A�C�'�8�8��z�Q�D�Q�K�A�C��k�k�#����k�k�#����!'�
��}�=��� �+�+�-���N�N�,�D����$��?��
�
�d�4�@�?�-� >�
� � ����!1�6�3D�3D�3F�G�� � ����!1�6�3D�3D�3F�G�	@�?�s�/D/�/
D>c��[[S5nU<S3nUS-
nURXSS9 SSS5 g!,(df   g=f)z8Should displays error when errored python file is given.rr�zFunindent does not match any outer indentation level (<string>, line 3)T�rWr�N�rr�r�)rr&rWs   r�test_with_errored_file�&TestCommandLine.test_with_errored_file;sM��
�\�*:�;�
<�	�"�
�%:�;�F��-�
.�F����i�t��L�	=�
<�
<�s	�8�
Ac�~�[[S5nURU5 SSS5 g!,(df   g=f)zAShould not display anything if python file is correctly indented.r
Nr�r�s  r�test_with_error_free_file�)TestCommandLine.test_with_error_free_fileCs+��
�\�,�7�
8�I����i�(�9�
8�
8�r�c�F�[S5nSUS3nURUSS9 g)z%Should display usage on no arguments.ztabnanny.pyzUsage: z [-v] file_or_directory ...Tr�N)rr�)rr�rWs   r�test_command_usage�"TestCommandLine.test_command_usageHs.���
�&���4�&� ;�<��������=rc��[[S5nUS3nURSXS9 SSS5 g!,(df   g=f)z*Should display less when quite mode is on.rrPz-q)r|Nr�)rr&r|s   r�test_quiet_flag�TestCommandLine.test_quiet_flagNs=��
�\�*<�=�
>�)�!�{�"�%�F����d�I��=�?�
>�
>�s	�2�
Ac���[[S5n[R"S5R	5nURSXSS9 SSS5 g!,(df   g=f)z<Should display more error information if verbose mode is on.r�"offending line: '\tprint("world")'z-vT�r|r�N�rr��textwrap�dedent�stripr��rr�r|s   r�test_verbose_mode�!TestCommandLine.test_verbose_modeTsP��
�\�*<�=�
>�$��_�_�7���e�g�
�
���d�D���F�	?�
>�
>���6A�
A c���[[S5n[R"S5R	5nURSXSS9 SSS5 g!,(df   g=f)zBShould display detailed error information if double verbose is on.rr�z-vvTr�Nr�r�s   r�test_double_verbose_mode�(TestCommandLine.test_double_verbose_mode\sP��
�\�*<�=�
>�$��_�_�7���e�g�
�
���e�T�$��G�	?�
>�
>�r�r7N)
r1r2r3r4r5r�r�r�r�r�r�r�r6r7rrr�r�$s6��5�)+�B��V[�H�(M�)�
>�>�G�Hrr�)r5�unittestrrr�r�rBr�r"r��test.supportrrrr�test.support.os_helperr	r�rr9rHr[ror�r�r7rr�<module>r�s����
$��	�����$�$�)�
	�	%�	%�	%�	!�	'�K*��Z��&M�(�M�"C�8�C�(9�8�9�6qA��qA�h<��<�<>H�h�>Hr

Youez - 2016 - github.com/yon3zu
LinuXploit