404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.190.160.50: ~ $
3

�;Xd�@sJdZddlmZmZddlmZmZmZddlm	Z	Gdd�dej
�ZdS)zQ
Tests for the parts of jsonschema related to the :validator:`format` property.

�)�mock�unittest)�FormatError�ValidationError�
FormatChecker)�Draft4Validatorc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestFormatCheckercCstj�|_dS)N)rZMock�fn)�self�r�!/usr/lib/python3.6/test_format.py�setUp
szTestFormatChecker.setUpcCstfd�}|j|j�dS)N)�formats)rZassertFalse�checkers)r
�checkerrrr�test_it_can_validate_no_formatss
z1TestFormatChecker.test_it_can_validate_no_formatsc
Cs&|jt��tdgd�WdQRXdS)Nzo noes)r)�assertRaises�KeyErrorr)r
rrr�.test_it_raises_a_key_error_for_unknown_formatssz@TestFormatChecker.test_it_raises_a_key_error_for_unknown_formatscCsJtjjtjdd��.tjd�|j�|jtjd|jffi�WdQRXdS)NT)�clear�new)rZpatch�dictrrZ
cls_checksr	�assertEqual)r
rrr�!test_it_can_register_cls_checkerssz3TestFormatChecker.test_it_can_register_cls_checkerscCs8t�}|jd�|j�|j|jttj|jffd��dS)Nr)r)r�checksr	rrr)r
rrrr�test_it_can_register_checkerss
z/TestFormatChecker.test_it_can_register_checkerscCs�t�}t�}|j_|jdtd�|j�|jt��}|jdd�WdQRX|j|j	j
|�|j|j	j|�t|j_|jt��|jdd�WdQRXdS)N�foo)�raises�bar)
r�
ValueErrorr	�side_effectrrrZcheck�assertIs�	exception�cause�	__cause__�AttributeError)r
rr#�cmrrr�!test_it_catches_registered_errors%sz3TestFormatChecker.test_it_catches_registered_errorsc
Cslt�}|jdtd�|j�t�}|j_tddi|d�}|jt��}|jd�WdQRX|j	|j
j|�dS)Nr)r�format)Zformat_checkerr)rrrr	r rrrZvalidater!r"r$)r
rr#Z	validatorr&rrr�7test_format_error_causes_become_validation_error_causes6szITestFormatChecker.test_format_error_causes_become_validation_error_causesN)
�__name__�
__module__�__qualname__r
rrrrr'r)rrrrrsrN)�__doc__Zjsonschema.tests.compatrrZ
jsonschemarrrZjsonschema.validatorsrZTestCaserrrrr�<module>s

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
compat.cpython-36.opt-1.pyc File 305 B 0644
compat.cpython-36.pyc File 305 B 0644
test_cli.cpython-36.opt-1.pyc File 4.31 KB 0644
test_cli.cpython-36.pyc File 4.31 KB 0644
test_exceptions.cpython-36.opt-1.pyc File 13.37 KB 0644
test_exceptions.cpython-36.pyc File 13.37 KB 0644
test_format.cpython-36.opt-1.pyc File 2.74 KB 0644
test_format.cpython-36.pyc File 2.74 KB 0644
test_jsonschema_test_suite.cpython-36.opt-1.pyc File 9.67 KB 0644
test_jsonschema_test_suite.cpython-36.pyc File 9.71 KB 0644
test_validators.cpython-36.opt-1.pyc File 31.29 KB 0644
test_validators.cpython-36.pyc File 31.29 KB 0644