Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/tap/tests/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/tap/tests/__pycache__/test_parser.cpython-37.pyc

B

.��V��@shddlZddlZddlZyddlmZWnek
rDddlZYnXddlmZGdd�dej�ZdS)�N)�mock)�Parserc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Ze�d"�d#d$��Zd%S)&�
TestParserzTests for tap.parser.ParsercCs>t�}|�d�}|�d|j�|�|j�|�|jdk�dS)zThe parser extracts an ok line.z!ok - This is a passing test line.�testN)r�
parse_line�assertEqual�category�
assertTrue�ok�number)�self�parser�line�r�F/opt/alt/python37/lib/python3.7/site-packages/tap/tests/test_parser.py�
test_finds_oks

zTestParser.test_finds_okcCs0t�}|�d�}|�d|j�|�d|j�dS)z"The parser extracts a test number.zok 42 is the magic number.r�*N)rrrrr)rr
rrrr�test_finds_numbers
zTestParser.test_finds_numbercCs0t�}|�d�}|�d|j�|�d|j�dS)Nzok 42 A passing test.rzA passing test.)rrrr�description)rr
rrrr�test_finds_description%s
z!TestParser.test_finds_descriptioncCs0t�}|�d�}|�d|j�|�d|j�dS)Nz+ok A description # Not part of description.rz
A description)rrrrr)rr
rrrr�"test_after_hash_is_not_description-s
z-TestParser.test_after_hash_is_not_descriptioncCs.t�}|�d�}|�d|j�|�|j�dS)Nz ok A description # TODO Not doner)rrrrr	�todo)rr
rrrr�test_finds_todo5s
zTestParser.test_finds_todocCs.t�}|�d�}|�d|j�|�|j�dS)Nzok A description # SKIP for nowr)rrrrr	�skip)rr
rrrr�test_finds_skip=s
zTestParser.test_finds_skipcCs>t�}|�d�}|�d|j�|�|j�|�|jdk�dS)z"The parser extracts a not ok line.z%not ok - This is a failing test line.rN)rrrr�assertFalser
r	r)rr
rrrr�test_finds_not_okEs

zTestParser.test_finds_not_okcCs"t�}|�d�}|�d|j�dS)z*The parser returns an unrecognizable line.z%This is not a valid TAP line. # srsly�unknownN)rrrr)rr
rrrr�test_unrecognizable_lineOs
z#TestParser.test_unrecognizable_linecCs4d}t�}|�|�}|�d|j�|�||j�dS)z&The parser extracts a diagnostic line.z# An example diagnostic line�
diagnosticN)rrrr�text)rr r
rrrr�test_diagnostic_lineWs

zTestParser.test_diagnostic_linecCs0t�}|�d�}|�d|j�|�d|j�dS)z$The parser extracts a bail out line.z%Bail out! This is the reason to bail.�bailzThis is the reason to bail.N)rrrr�reason)rr
rrrr�test_bail_out_lineas
zTestParser.test_bail_out_linecCs0t�}|�d�}|�d|j�|�d|j�dS)z#The parser extracts a version line.zTAP version 13�version�
N)rrrrr%)rr
rrrr�test_finds_versionjs
zTestParser.test_finds_versioncCst�}|�t|jd�dS)z=The TAP spec dictates that anything less than 13 is an error.zTAP version 12N)r�assertRaises�
ValueErrorr)rr
rrr�test_errors_on_old_versionssz%TestParser.test_errors_on_old_versioncCs0t�}|�d�}|�d|j�|�d|j�dS)z The parser extracts a plan line.z1..42�planrN)rrrr�expected_tests)rr
rrrr�test_finds_planys
zTestParser.test_finds_plancCs.t�}|�d�}|�d|j�|�|j�dS)z2The parser extracts a plan line containing a SKIP.z 1..42 # Skipping this test file.r+N)rrrrr	r)rr
rrrr�test_finds_plan_with_skip�s
z$TestParser.test_finds_plan_with_skipcCs"t�}|�d�}|�d|j�dS)z4The parser only recognizes SKIP directives in plans.z1..42 # TODO will not work.rN)rrrr)rr
rrrr�-test_ignores_plan_with_any_non_skip_directive�s
z8TestParser.test_ignores_plan_with_any_non_skip_directivecCs�t�d�}tjdd�}|�|�d��|��t�}g}x|�|j	�D]}|�
|�qFW|�dt|��|�d|dj
�|�d|d	j
�|�|d	j�|�d|d
j
�|�|d
j�dS)NzH1..2
            ok 1 A passing test
            not ok 2 A failing testF)�deletezutf-8�r+rr��)�inspect�cleandoc�tempfile�NamedTemporaryFile�write�encode�closer�
parse_file�name�appendr�lenrr	r
r)r�sample�tempr
�linesrrrr�test_parses_file�szTestParser.test_parses_fileztap.parser.syscCs�dd�}t��}||_|t|�_t�}g}x|��D]}|�|�q4W|�dt	|��|�d|dj
�|�d|dj
�|�|dj�|�d|dj
�|�
|dj�dS)	NcssdVdVdVdS)Nz1..2
zok 1 A passing test
znot ok 2 A failing test
rrrrr�
stdin_data�sz0TestParser.test_parses_stdin.<locals>.stdin_datar1r+rrr2r3)rZPropertyMockZside_effect�type�stdinrZparse_stdinr=rr>rr	r
r)rZmock_sysrCZ
mock_stdinr
rArrrr�test_parses_stdin�s
zTestParser.test_parses_stdinN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr!r$r'r*r-r.r/rBr�patchrFrrrrrs$
	

				r)	r4r6�unittestr�ImportErrorZ
tap.parserr�TestCaserrrrr�<module>s