Sindbad~EG File Manager
�
)Μg]\ � � � d Z ddlmZ ddlmZmZ ddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZ ddlmZ ddlmZ dd lmZ G d
� dej2 � Z G d� d
ej2 � Z G d� dej2 � Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z! G d� de� Z" G d� de� Z# G d� de� Z$ G d � d!e� Z% G d"� d#e� Z& G d$� d%e� Z' G d&� d'e� Z( G d(� d)e� Z) G d*� d+ej2 � Z* G d,� d-e� Z+ G d.� d/e� Z, G d0� d1e� Z- G d2� d3ej2 � Z.d4� Z/e0d5k( r ejb � yy)6aF Test suite for 2to3's parser and grammar files.
This is the place to add tests for changes to 2to3's grammar, such as those
merging the grammars for Python 2 and 3. In addition to specific tests for
parts of the grammar we've changed, we also make sure we can parse the
test_grammar.py files from both Python 2 and Python 3.
� )�support)�driver�driver_no_print_statement� N)r )�tokenize)�
ParseError)�python_symbolsc � � e Zd Zd� Zy)�
TestDriverc �B � d}t j |� }| j |j d j d j t
j � | j |j d j d j t
j � y )Nzprint 1
print 2
r r )r �parse_string�assertEqual�children�type�syms�
print_stmt)�self�s�ts �:/usr/local/lib/python3.12/test/test_lib2to3/test_parser.py�
test_formfeedzTestDriver.test_formfeed# sq � �(������"��������A��/�/��2�7�7����I�������A��/�/��2�7�7����I� N)�__name__�
__module__�__qualname__r � r r r r ! s � �Jr r c � � e Zd Zd� Zd� Z ej ej du d� ej ej dv d� d� � � Z
d� Zy) �TestPgen2Cachingc �P � t j t j dd�� y )NFT��save�force)�pgen2_driver�load_grammarr �grammar_path�r s r �test_load_grammar_from_txt_filez0TestPgen2Caching.test_load_grammar_from_txt_file+ s � ��!�!�'�"6�"6�U�$�Or c �z � t j � } t j j |t j j t j � � }t j t j |� t j |� }t j |dd�� | j t j j |� � t j |� t j |dd�� t j |� y # t j |� w xY w)NTr F)�tempfile�mkdtemp�os�path�join�basenamer r% �shutil�copyr# �_generate_pickle_namer$ �
assertTrue�exists�unlink�rmtree)r �tmpdir�grammar_copy�pickle_names r �test_load_grammar_from_picklez.TestPgen2Caching.test_load_grammar_from_pickle. s� � � �!�!�#�� "��7�7�<�<��B�G�G�,�,�W�-A�-A�B�D�L��K�K��,�,�l�;�&�<�<�\�J�K��%�%�l��T�J��O�O�B�G�G�N�N�;�7�8��I�I�l�#��%�%�l��e�L��M�M�&�!��F�M�M�&�!�s �C7D# �#D:Nzsys.executable required> �wasi�
emscriptenzrequires working subprocessc �B � t j � }t j j |d� } t j
|� t j j
t j � }t j j ||� }t j j ||� }t j t j |� t j t j |� t j |� }t j |� }| j ||� t j |dd�� | j t j j! |� � t# t j$ � }d|d<