Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_source_encoding.cpython-311.pyc |
�
�Kec1 � �N � d dl Z d dlmZmZmZ d dlmZmZmZ d dl m
Z
d dlZd dlZd dl
Z
d dlZd dlZ G d� de j � � Z G d� d� � Z G d � d
e j � � Z G d� dee j � � Z G d
� dee j � � Zedk r e j � � dS dS )� N)�
script_helper�captured_stdout�requires_subprocess)�TESTFN�unlink�rmtree)�unloadc � � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Z e � � d� � � Z
d� Zd � Zd
� Z
d� Zd� Zd
� Zd� Zd� Zd� ZdS )�MiscSourceEncodingTestc � � | � d� d� � d� � | � d� d� � d� � d S )Nu
Питон�utf-8s
Питонu \Пs \П)�assertEqual�encode��selfs �C/usr/local/apps/python3/lib/python3.11/test/test_source_encoding.py�test_pep263z"MiscSourceEncodingTest.test_pep263 sd � ��������(�(�7�
�
�
�
����L�L��!�!��
�
�
�
�
� c � � t ddd� � }i }t ||� � | � |d d� � d S )Ns
# coding: utf-8
u = 'ó'
�dummy�exec�u� ó��compiler r �r �c�ds r �test_compilestringz)MiscSourceEncodingTest.test_compilestring sF � ��:�G�V�L�L�����Q��
�
�
�����3���(�(�(�(�(r c �� � t ddd� � | � � � d S # t $ r9}| � |j � d� � d� � Y d }~d S d }~ww xY w)Ns # coding: cp932
print '�N'r r �
u print '年')r �fail�SyntaxErrorr �text�rstrip)r �vs r �test_issue2301z%MiscSourceEncodingTest.test_issue2301 s� � � ��8�'�6�J�J�J�
�I�I�K�K�K�K�K�� � D� D� D����Q�V�]�]�4�0�0�2B�C�C�C�C�C�C�C�C�C����� D���s �) �
A,�.A'�'A,c � � t ddd� � }i }t ||� � | � |d d� � d S )Nu # coding=latin-1
Æ = 'Æ'r r � Ær r s r �test_issue4626z%MiscSourceEncodingTest.test_issue4626( sF � ��9�7�F�K�K�����Q��
�
�
�����6��F�+�+�+�+�+r c � � t ddd� � }i }t ||� � | � |d |d � � | � t |d � � t |d � � � � | � t |d � � t |d � � � � d S )Nu a, b = '𐄏', '\U0001010F'r r �a�b)r r r �len�asciir s r �test_issue3297z%MiscSourceEncodingTest.test_issue3297. s� � ��8�'�6�J�J�����Q��
�
�
�����3���3��(�(�(�����Q�s�V���c�!�C�&�k�k�2�2�2�����q��v����a��f�
�
�6�6�6�6�6r c �� � | � t t d� � | � t t d� � | � t t d� � d S )Ns � s � s � )�assertRaisesr# �evalr s r �test_issue7820z%MiscSourceEncodingTest.test_issue78206 sV � �
���+�t�[�9�9�9�
���+�t�[�9�9�9�
���+�t�_�=�=�=�=�=r c �t � t j t j t j � t j � t � � d� � gt j �� � }|�
� � d }| � |j d� � | �
d|� � d S )Nzcoding20731.py)�stderr� r s SyntaxError)�
subprocess�Popen�sys�
executable�os�path�join�dirname�__file__�PIPE�communicater �
returncode�assertNotIn)r �sub�errs r �
test_20731z!MiscSourceEncodingTest.test_20731D s� � ���������R�W�_�_�X�%>�%>�%5�7� 7� 8� *��0� 0� 0�� �o�o����"��������+�+�+������-�-�-�-�-r c � � t ddd� � t ddd� � t ddd� � | � t d� � 5 t ddd� � d d d � � n# 1 swxY w Y | � t d� � 5 t d dd� � d d d � � n# 1 swxY w Y | � t d
� � 5 t d dd� � d d d � � n# 1 swxY w Y | � t d� � 5 t ddd� � d d d � � n# 1 swxY w Y | � t d
� � 5 t ddd� � d d d � � d S # 1 swxY w Y d S )Ns # -*- coding: iso-8859-15 -*-
r r s
s # -*- coding: utf-8 -*-
�fakes # -*- coding: fake -*-
ziso-8859-15s! # -*- coding: iso-8859-15 -*-
�BOMs # -*- coding: fake -*-
)r �assertRaisesRegexr# r s r �test_error_messagez)MiscSourceEncodingTest.test_error_messageN s � ��2�G�V�D�D�D��!�7�F�3�3�3��8�'�6�J�J�J�
�
#�
#�K��
8�
8� B� B��/��&�A�A�A� B� B� B� B� B� B� B� B� B� B� B���� B� B� B� B�
�
#�
#�K��
?�
?� %� %��B��V�
%�
%�
%� %� %� %� %� %� %� %� %� %� %� %���� %� %� %� %� �
#�
#�K��
7�
7� %� %��B��V�
%�
%�
%� %� %� %� %� %� %� %� %� %� %� %���� %� %� %� %� �
#�
#�K��
8�
8� N� N��;�W�f�M�M�M� N� N� N� N� N� N� N� N� N� N� N���� N� N� N� N�
�
#�
#�K��
7�
7� N� N��;�W�f�M�M�M� N� N� N� N� N� N� N� N� N� N� N� N���� N� N� N� N� N� NsZ �A-�-A1�4A1�B1�1B5�8B5�C5�5C9�<C9�D9�9D=� D=�E>�>F�Fc �4 � d}| � |� � d S )N�
bad_coding��verify_bad_module�r �module_names r �test_bad_codingz&MiscSourceEncodingTest.test_bad_coding_ s! � �"�����{�+�+�+�+�+r c �4 � d}| � |� � d S )N�bad_coding2rO rQ s r �test_bad_coding2z'MiscSourceEncodingTest.test_bad_coding2c s! � �#�����{�+�+�+�+�+r c � � | � t t d|z � � t j � t � � }t j � ||dz � � }t |d� � 5 }|� � � }d d d � � n# 1 swxY w Y | � t t ||d� � d S )Nztest.�.py�rbr )r2 r# �
__import__r<