HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_keyword.cpython-37.pyc
B

��g��@s�ddlZddlZddlmZddlZddlZddlZddlZddlZddl	Z	e�
d�Zej�
ej�e�ddddd�ZdZdZd	Zd
ZGdd�dej�ZGd
d�dej�Zedkr�e��dS)�N)�supportz
keyword.pyz..�Pythonz
graminit.czkeyword_test.pyzgraminit_test.czminimal_keyword.pyznot_here.txtc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�Test_iskeywordcCs|�t�d��dS)N�True)�
assertTrue�keyword�	iskeyword)�self�r
�-/usr/local/lib/python3.7/test/test_keyword.py�test_true_is_a_keywordsz%Test_iskeyword.test_true_is_a_keywordcCs|�t�d��dS)NZTRUE)�assertFalserr)r	r
r
r�$test_uppercase_true_is_not_a_keywordsz3Test_iskeyword.test_uppercase_true_is_not_a_keywordcCs|�t�d��dS)N)r
rr)r	r
r
r� test_none_value_is_not_a_keywordsz/Test_iskeyword.test_none_value_is_not_a_keywordcCs>tj}|�ttd|�dddddddgt_|�t�d��dS)	N�kwlistZits�allZeggsZbeans�and�a�slice)rr�
addCleanup�setattrr
r)r	Zoldlistr
r
r�2test_changing_the_kwlist_does_not_affect_iskeyword szATest_iskeyword.test_changing_the_kwlist_does_not_affect_iskeywordN)�__name__�
__module__�__qualname__rrrrr
r
r
rrsrc@sbeZdZdd�Zdd�Ze�ej�	e
�d�dd��Zdd	�Zd
d�Z
dd
�Zdd�Zdd�ZdS)�TestKeywordGenerationc	Cs�t|d��}|��}WdQRX|dt|d���d�}t|d��B}|�|d|�d|�d��|�||�d|�d��WdQRXdS)N�rbr�wbs#--start keywords--�s#--end keywords--)�open�	readlines�len�strip�
writelines�index)r	Zsource_fileZ	dest_file�fp�lines�nlr
r
r�%_copy_file_without_generated_keywords)s z;TestKeywordGeneration._copy_file_without_generated_keywordscCs0tjtjt||gtjd�}|��d}|j|fS)N)�stderrr)�
subprocess�Popen�sys�
executable�KEYWORD_FILE�PIPEZcommunicate�
returncode)r	Zgrammar_fileZtarget_keyword_py_file�procr)r
r
r�_generate_keywords1sz(TestKeywordGeneration._generate_keywordsz+test only works from source build directorycCsV|�tt�|�tjt�|�t�tt��|�	d|�
tt��|�t�tt��dS)N)r�)
r(r.�TEST_PY_FILErr�unlinkr
�filecmp�cmp�assertEqualr2�GRAMMAR_FILEr)r	r
r
r�"test_real_grammar_and_keyword_file9sz8TestKeywordGeneration.test_real_grammar_and_keyword_filec	Cs�|�tt�|�tjt�ttd��}|�t	�
d��WdQRX|�tjt�|�tt�ddddddd	d
dg	}tt��}|���
�}WdQRX|�d�d
}|�d�}|||�}|�||�dS)N�wa�                {2, 1},
                    {11, "encoding_decl", 0, 2, states_79,
                     " "
                     ""},
                    {1, "jello"},
                    {326, 0},
                    {1, "turnip"},
                	{1, "This one is tab indented"
                    {278, 0},
                    {1, "crazy but legal"
                "also legal" {1, "
                    {1, "continue"},
                   {1, "lemon"},
                     {1, "tomato"},
                {1, "wigii"},
                    {1, 'no good'}
                    {283, 0},
                    {1,  "too many spaces"}z#        'This one is tab indented',z        'also legal',z        'continue',z        'crazy but legal',z        'jello',z        'lemon',z        'tomato',z        'turnip',z        'wigii',z#--start keywords--rz#--end keywords--)r(r.r4rrr5r�GRAMMAR_TEST_FILEr#�textwrap�dedentr2�read�
splitlinesr$r8)r	r%Zexpectedr&�start�end�actualr
r
r�test_grammarCs,

z"TestKeywordGeneration.test_grammarcCs`|�tt�|�tjt�t�tt�|�tjt�|�	d|�
tjt��|�
t�tt��dS)N)rr3)r(r.�PY_FILE_WITHOUT_KEYWORDSrrr5�shutilZcopyfiler4r8r2�os�devnullrr6r7)r	r
r
r�)test_empty_grammar_results_in_no_keywordsosz?TestKeywordGeneration.test_empty_grammar_results_in_no_keywordscCs0|�tjtj�\}}|�|d�|�|d�dS)Nrsdoes not contain format markers)r2rGrH�assertNotEqual�assertRegex)r	�rcr)r
r
r�/test_keywords_py_without_markers_produces_erroryszETestKeywordGeneration.test_keywords_py_without_markers_produces_errorcCs4|�tt�\}}|�|d�|�|dt���dS)Nrs(?ms))r2�NONEXISTENT_FILEr.rJrK�encode)r	rLr)r
r
r�(test_missing_grammar_file_produces_error~sz>TestKeywordGeneration.test_missing_grammar_file_produces_errorcCs6|�tjt�\}}|�|d�|�|dt���dS)Nrs(?ms))r2rGrHrNrJrKrO)r	rLr)r
r
r�,test_missing_keywords_py_file_produces_error�szBTestKeywordGeneration.test_missing_keywords_py_file_produces_errorN)rrrr(r2�unittestZskipIfrG�path�existsr9r:rDrIrMrPrQr
r
r
rr's	,
r�__main__)rrRZtestrr6rGr,r*rFr=Zfindfiler.rS�join�split�__file__r9r4r<rErNZTestCaserrr�mainr
r
r
r�<module>s&
b