%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/utils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/utils/__pycache__/_junit_xml.cpython-39.pyc

a

�)g#"�@s�dZddlmZddlZddlZddlZddlZddlmZddl	m
ZejGdd�dej
d��ZejGd	d
�d
e��ZejGdd�de��ZejGd
d�d��ZejGdd�d��ZejGdd�d��Zdd�dd�Zddd�dd�ZdS)z�
Dataclasses for creating JUnit XML files.
See: https://github.com/junit-team/junit5/blob/main/platform-tests/src/test/resources/jenkins-junit.xsd
�)�annotationsN)�minidom)�ElementTreec@sreZdZUdZdZded<dZded<dZded<dd�Ze	e
jd	d
�dd���Zd
d
�dd�Z
dd
�dd�ZdS)�
TestResultz)Base class for the result of a test case.N�
str | None�output�message�typecCs|jdur|j|_dS�N)r	�tag��self�r�</usr/lib/python3.9/site-packages/ansible/utils/_junit_xml.py�
__post_init__s
zTestResult.__post_init__�str��returncCsdS)�9Tag name for the XML element created by this result type.NrrrrrrszTestResult.tag�dict[str, str]cCst|j|jd�S)�4Return a dictionary of attributes for this instance.)rr	)�_attributesrr	rrrr�get_attributes#s�zTestResult.get_attributes�
ET.ElementcCst�|j|���}|j|_|S)�1Return an XML element representing this instance.)�ET�Elementrrr�text�r
�elementrrr�get_xml_element*szTestResult.get_xml_element)�__name__�
__module__�__qualname__�__doc__r�__annotations__rr	r�property�abc�abstractmethodrrr rrrrrs
r)�	metaclassc@s"eZdZdZedd�dd��ZdS)�TestFailurezFailure info for a test case.rrcCsdS)r�failurerrrrrr6szTestFailure.tagN�r!r"r#r$r&rrrrrr*2sr*c@s"eZdZdZedd�dd��ZdS)�	TestErrorzError info for a test case.rrcCsdS)r�errorrrrrrr@sz
TestError.tagNr,rrrrr-<sr-c@s�eZdZUdZded<dZded<dZded<dZded	<dZd
ed<e	j
ed�Zd
ed<e	j
ed�Z
ded<dZded<dZded<dZded<dZded<edd�dd��Zedd�dd��Zedd�dd��Zdd�dd �Zd!d�d"d#�ZdS)$�TestCasezAn individual test case.r�nameNz
int | None�
assertionsr�	classname�statuszdecimal.Decimal | None�time��default_factoryzlist[TestError]�errorszlist[TestFailure]�failures�skipped�
system_out�
system_errF�bool�is_disabledrcCs
t|j�S)z,True if the test case contains failure info.)r<r8rrrr�
is_failureXszTestCase.is_failurecCs
t|j�S)z*True if the test case contains error info.)r<r7rrrr�is_error]szTestCase.is_errorcCs
t|j�S)z"True if the test case was skipped.)r<r9rrrr�
is_skippedbszTestCase.is_skippedrcCst|j|j|j|j|jd�S)r)r1r2r0r3r4)rr1r2r0r3r4rrrrrgs�zTestCase.get_attributesrcCs�t�d|���}|jr&|jt�|d�_|�dd�|jD��|�dd�|jD��|j	rh|j	t�|d�_|j
r~|j
t�|d�_|S)rZtestcaser9cSsg|]}|���qSr�r )�.0r.rrr�
<listcomp>x�z,TestCase.get_xml_element.<locals>.<listcomp>cSsg|]}|���qSrrA)rBr+rrrrCyrD�
system-out�
system-err)rrrr9�
SubElementr�extendr7r8r:r;rrrrr qszTestCase.get_xml_element)r!r"r#r$r%r1r2r3r4�dataclasses�field�listr7r8r9r:r;r=r&r>r?r@rr rrrrr/Fs(

r/c@seZdZUdZded<dZded<dZded<dZded<dZd	ed
<e	j
ed�Zded
<e	j
e
d�Zded<dZded<dZded<dd�Zedd�dd��Zedd�dd��Zedd�dd��Zedd�dd��Zedd�dd��Zed d�d!d"��Zdd�d#d$�Zd%d�d&d'�ZdS)(�	TestSuitezA collection of test cases.rr0Nr�hostname�id�packagezdatetime.datetime | None�	timestampr5r�
propertieszlist[TestCase]�casesr:r;cCs,|jr(|jjtjjkr(tdtjj����dS)Nztimestamp.tzinfo must be )rP�tzinfo�datetime�timezoneZutc�
ValueErrorrrrrr�szTestSuite.__post_init__�intrcCstdd�|jD��S)�"The number of disabled test cases.css|]}|jVqdSr
)r=�rBZcaserrr�	<genexpr>�rDz%TestSuite.disabled.<locals>.<genexpr>��sumrRrrrr�disabled�szTestSuite.disabledcCstdd�|jD��S)�/The number of test cases containing error info.css|]}|jVqdSr
)r?rYrrrrZ�rDz#TestSuite.errors.<locals>.<genexpr>r[rrrrr7�szTestSuite.errorscCstdd�|jD��S)�1The number of test cases containing failure info.css|]}|jVqdSr
)r>rYrrrrZ�rDz%TestSuite.failures.<locals>.<genexpr>r[rrrrr8�szTestSuite.failurescCstdd�|jD��S)z1The number of test cases containing skipped info.css|]}|jVqdSr
)r@rYrrrrZ�rDz$TestSuite.skipped.<locals>.<genexpr>r[rrrrr9�szTestSuite.skippedcCs
t|j�S)�The number of test cases.)�lenrRrrrr�tests�szTestSuite.tests�decimal.DecimalcCst�tdd�|jD���S)�#The total time from all test cases.css|]}|jr|jVqdSr
�r4rYrrrrZ�rDz!TestSuite.time.<locals>.<genexpr>)�decimal�Decimalr\rRrrrrr4�szTestSuite.timecCsNt|j|j|j|j|j|j|j|j|j	|j
|jrF|jjdd�j
dd�ndd�S)rN)rSZseconds)Ztimespec)r]r7r8rMrNr0rOr9rbr4rP)rr]r7r8rMrNr0rOr9rbr4rP�replaceZ	isoformatrrrrr�s�zTestSuite.get_attributesrcCs~t�d|���}|jr8t�|d��dd�|j��D��|�dd�|jD��|jrd|jt�|d�_	|j
rz|j
t�|d�_	|S)rZ	testsuiterQc	Ss$g|]\}}t�dt||d���qS)r&)r0�value)rr�dict)rBr0rirrrrC�rDz-TestSuite.get_xml_element.<locals>.<listcomp>cSsg|]}|���qSrrA)rBZ	test_caserrrrC�rDrErF)rrrrQrGrH�itemsrRr:rr;rrrrr �s"zTestSuite.get_xml_element)r!r"r#r$r%rMrNrOrPrIrJrjrQrKrRr:r;rr&r]r7r8r9rbr4rr rrrrrL�s2
rLc@s�eZdZUdZdZded<ejed�Z	ded<e
dd	�d
d��Ze
dd	�dd
��Ze
dd	�dd��Z
e
dd	�dd��Ze
dd	�dd��Zdd	�dd�Zdd	�dd�Zdd	�dd�ZdS)�
TestSuiteszA collection of test suites.Nrr0r5zlist[TestSuite]�suitesrWrcCstdd�|jD��S)rXcss|]}|jVqdSr
)r]�rBZsuiterrrrZ�rDz&TestSuites.disabled.<locals>.<genexpr>�r\rmrrrrr]�szTestSuites.disabledcCstdd�|jD��S)r^css|]}|jVqdSr
)r7rnrrrrZ�rDz$TestSuites.errors.<locals>.<genexpr>rorrrrr7�szTestSuites.errorscCstdd�|jD��S)r_css|]}|jVqdSr
)r8rnrrrrZ�rDz&TestSuites.failures.<locals>.<genexpr>rorrrrr8�szTestSuites.failurescCstdd�|jD��S)r`css|]}|jVqdSr
)rbrnrrrrZ�rDz#TestSuites.tests.<locals>.<genexpr>rorrrrrb�szTestSuites.testsrccCst�tdd�|jD���S)rdcss|]}|jVqdSr
rernrrrrZ�rDz"TestSuites.time.<locals>.<genexpr>)rfrgr\rmrrrrr4�szTestSuites.timercCs t|j|j|j|j|j|jd�S)r)r]r7r8r0rbr4)rr]r7r8r0rbr4rrrrr�s�zTestSuites.get_attributesrcCs*t�d|���}|�dd�|jD��|S)rZ
testsuitescSsg|]}|���qSrrArnrrrrCrDz.TestSuites.get_xml_element.<locals>.<listcomp>)rrrrHrmrrrrr szTestSuites.get_xml_elementrcCst|���S)z@Return a pretty formatted XML string representing this instance.)�_pretty_xmlr rrrr�
to_pretty_xml
szTestSuites.to_pretty_xml)r!r"r#r$r0r%rIrJrKrmr&r]r7r8rbr4rr rqrrrrrl�s 
rlrrcKsdd�|��D�S)zuReturn the given kwargs as a dictionary with values converted to strings. Items with a value of None will be omitted.cSs"i|]\}}|dur|t|��qSr
)r)rB�keyrirrr�
<dictcomp>rDz_attributes.<locals>.<dictcomp>)rk)�kwargsrrrrsrrr)rrcCst�tj|dd����S)zDReturn a pretty formatted XML string representing the given element.Zunicode)�encoding)rZparseStringrZtostringZtoprettyxml)rrrrrpsrp)r$Z
__future__rr'rIrTrfZxml.domrZ	xml.etreerrZ	dataclass�ABCMetarr*r-r/rLrlrrprrrr�<module>s*		=R7

Zerion Mini Shell 1.0