%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/hyperlink/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/hyperlink/test/__pycache__/test_hypothesis.cpython-312.pyc

�

�(_����dZ	ddlZ[ddlmZddlmZmZ	ddlmZddlmZmZddl
mZmZddlmZmZmZd	d
lmZddlmZmZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"Gd�de�Z#y#e	$r	ddl
mZY�WwxYw#e	$rYywxYw)z!
Tests for hyperlink.hypothesis.
�N)�digits)�Sequence�Text)�patch)�given�settings)�SearchStrategy�data)�	IDNAError�check_label�encode�)�HyperlinkTestCase�)�
DecodedURL�
EncodedURL)	�DrawCallable�	composite�decoded_urls�encoded_urls�hostname_labels�	hostnames�	idna_text�paths�port_numbersc�R�eZdZdZee��d��Zee��d��Zee	��d��Z
ee	d���d��Zee��d��Z
ee��ed	�
�d���Zeed�
��d��Zee��d��Zeed���d��Zeed�
��d��Zeedd���d��Zee��d��Zee��d��Zee��d��Zy)�TestHypothesisStrategiesz1
        Tests for hyperlink.hypothesis.
        c�j�	t|�y#t$rtdj|���wxYw)zD
            idna_text() generates IDNA-encodable text.
            zInvalid IDNA text: {!r}N)�idna_encoder�AssertionError�format)�self�texts  �@/usr/lib/python3/dist-packages/hyperlink/test/test_hypothesis.py�test_idna_text_validz-TestHypothesisStrategies.test_idna_text_valid-s8��
M��D�!���
M�$�%>�%E�%E�d�%K�L�L�
M�s��$2c��|jt|jtd���|jt|jtd���y)zO
            idna_text() raises AssertionError if min_size is < 1.
            r)�min_size)�max_sizeN)�assertRaisesr �drawr)r"r
s  r$�test_idna_text_min_maxz/TestHypothesisStrategies.test_idna_text_min_max8s:��
���n�d�i�i��A�9N�O����n�d�i�i��A�9N�O�c�L�|j|d�|j|d�y)z[
            port_numbers() generates integers between 1 and 65535, inclusive.
            r�N��assertGreaterEqual�assertLessEqual�r"�ports  r$�test_port_numbers_boundsz1TestHypothesisStrategies.test_port_numbers_boundsAs$��
�#�#�D�!�,�� � ��u�-r,T)�
allow_zeroc�L�|j|d�|j|d�y)zv
            port_numbers(allow_zero=True) generates integers between 0 and
            65535, inclusive.
            rr.Nr/r2s  r$�#test_port_numbers_bounds_allow_zeroz<TestHypothesisStrategies.test_port_numbers_bounds_allow_zeroJs$��
�#�#�D�!�,�� � ��u�-r,c��	t|�t|�y#t$rtdj	|���wxYw)zK
            hostname_labels() generates IDN host name labels.
            �Invalid IDN label: {!r}N)rr�UnicodeErrorr r!�r"�labels  r$�test_hostname_labels_valid_idnz7TestHypothesisStrategies.test_hostname_labels_valid_idnTs@��
N��E�"��E�"���
N�$�%>�%E�%E�e�%L�M�M�
N�s��$=�
)�max_examplesc��td��}td|�5|jt��}	t	|�t|�	ddd�y#t$rtdj|���wxYw#1swYyxYw)z�
            hostname_labels() handles case where idna_text() generates text
            that encoded to punycode ends up as longer than allowed.
            c��d|zS)N�á�)r*r'r(s   r$�mock_idna_textzWTestHypothesisStrategies.test_hostname_labels_long_idn_punycode.<locals>.mock_idna_textis��>��H�Hr,zhyperlink.hypothesis.idna_textr9N)	rrr*rrrr:r r!)r"r
rDr<s    r$�&test_hostname_labels_long_idn_punycodez?TestHypothesisStrategies.test_hostname_labels_long_idn_punycode`s����
I��
I��7��H�
�!��	�	�/�"3�4�����&���&�	
�
��
$��(�1�8�8��?�����
�
�s�A<�A�$A9�9A<�<BF)�	allow_idnc��	t|�|jd�y#t$rtdj	|���wxYw)zO
            hostname_labels() generates a ASCII host name labels.
            �asciizInvalid ASCII label: {!r}N)rr
r:r r!r;s  r$� test_hostname_labels_valid_asciiz9TestHypothesisStrategies.test_hostname_labels_valid_ascii}sD��
P��E�"����W�%���
P�$�%@�%G�%G��%N�O�O�
P�s	��$Ac��	|jd�D]
}t|��t|�y#t$rt	dj|���wxYw)zA
            hostnames() generates a IDN host names.
            �.zInvalid IDN host name: {!r}N)�splitrrr:r r!�r"�hostnamer<s   r$�test_hostnames_idnz+TestHypothesisStrategies.test_hostnames_idn�sY��
�%�^�^�D�1�'�E���&�'��H�%���
�$�1�8�8��B���
�s	�,/�$A)�allow_leading_digitc�R�|j||jt�k(�y)z}
            hostnames(allow_leading_digit=False) generates a IDN host names
            without leading digits.
            N��
assertTrue�lstripr�r"rNs  r$�test_hostnames_idn_noleadz2TestHypothesisStrategies.test_hostnames_idn_nolead����
�O�O�H�����(?�?�@r,c��	|jd�D]
}t|��|jd�y#t$rt	dj|���wxYw)zC
            hostnames() generates a ASCII host names.
            rKrHzInvalid ASCII host name: {!r}N)rLrr
r:r r!rMs   r$�test_hostnames_asciiz-TestHypothesisStrategies.test_hostnames_ascii�s]��
�%�^�^�D�1�'�E���&�'�����(���
�$�3�:�:�8�D���
�s	�25�$A)rPrFc�R�|j||jt�k(�y)z�
            hostnames(allow_leading_digit=False, allow_idn=False) generates
            ASCII host names without leading digits.
            NrRrUs  r$�test_hostnames_ascii_noleadz4TestHypothesisStrategies.test_hostnames_ascii_nolead�rWr,c���dj|�}	|jd�|D]}|jd|��y#t$rtdj	|���wxYw)zM
            paths() generates sequences of URL path components.
            �/zutf-8zInvalid URL path: {!r}z#/?N)�joinr
r:r r!�assertNotIn)r"�pathr#�segments    r$�
test_pathsz#TestHypothesisStrategies.test_paths�sn���9�9�T�?�D�
L����G�$� �
1��� � ���0�
1�� �
L�$�%=�%D�%D�T�%J�K�K�
L�s	�>�$A"c�0�|j|t�y)z?
            encoded_urls() generates EncodedURLs.
            N)�assertIsInstancer�r"�urls  r$�test_encoded_urlsz*TestHypothesisStrategies.test_encoded_urls����
�!�!�#�z�2r,c�0�|j|t�y)z?
            decoded_urls() generates DecodedURLs.
            N)rdrres  r$�test_decoded_urlsz*TestHypothesisStrategies.test_decoded_urls�rhr,N)�__name__�
__module__�__qualname__�__doc__rrr%r
r+rr4r7rr=rrErIrrOrVrYr[rrbrrgrrjrCr,r$rr(s���	�
�y�{�	�	M�
�	M�
�t�v��	P�
�	P�
�|�~�	�	.�
�	.�
�|�t�,�	-�	.�
.�	.�
�� �	!�		N�
"�		N�
�t�v��	�r�	"�	�
#�
�	�6
���/�	0�		P�
1�		P�
�y�{�	�	�
�	�
�y�U�3�	4�	A�
5�	A�
�y�5�)�	*�	�
+�	�
�y�U�e�D�	E�	A�
F�	A�
�u�w��	1�
�	1�
�|�~�	�	3�
�	3�
�|�~�	�	3�
�	3r,r)$rn�
hypothesis�stringr�typingrr�
unittest.mockr�ImportError�mockrr�hypothesis.strategiesr	r
�idnarrr
r�commonr�rrrrrrrrrrrrrCr,r$�<module>rys���P3����%��'�+�:�B�B�)�)�
�
�
�n3�#4�n3��-������	��	�s"�A9�A(�(A6�5A6�9B�B

Zerion Mini Shell 1.0