HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //lib/python3/dist-packages/hyperlink/test/__pycache__/test_hypothesis.cpython-310.pyc
o

�(_��@sdZzddlZ[Wn
eyYdSwddlmZddlmZmZzddlm	Z	Wney9ddl
m	Z	YnwddlmZmZddl
mZmZddlmZmZmZd	d
lmZddlmZmZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"Gdd�de�Z#dS)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@s,eZdZdZee��dd��Zee��dd��Zee	��dd��Z
ee	dd	��d
d��Zee��dd
��Z
ee��edd�dd���Zeedd��dd��Zee��dd��Zeedd��dd��Zeedd��dd��Zeeddd��dd��Zee��d d!��Zee��d"d#��Zee��d$d%��Zd&S)'�TestHypothesisStrategiesz1
        Tests for hyperlink.hypothesis.
        cCs,zt|�WdStytd�|���w)zD
            idna_text() generates IDNA-encodable text.
            zInvalid IDNA text: {!r}N)�idna_encoder
�AssertionError�format)�self�text�r!�@/usr/lib/python3/dist-packages/hyperlink/test/test_hypothesis.py�test_idna_text_valid-s
�z-TestHypothesisStrategies.test_idna_text_validcCs0|�t|jtdd��|�t|jtdd��dS)zO
            idna_text() raises AssertionError if min_size is < 1.
            r)�min_size)�max_sizeN)ZassertRaisesr�drawr)rr	r!r!r"�test_idna_text_min_max8sz/TestHypothesisStrategies.test_idna_text_min_maxcC�|�|d�|�|d�dS)z[
            port_numbers() generates integers between 1 and 65535, inclusive.
            r
�N�ZassertGreaterEqualZassertLessEqual�rZportr!r!r"�test_port_numbers_boundsAsz1TestHypothesisStrategies.test_port_numbers_boundsT)Z
allow_zerocCr()zv
            port_numbers(allow_zero=True) generates integers between 0 and
            65535, inclusive.
            rr)Nr*r+r!r!r"�#test_port_numbers_bounds_allow_zeroJsz<TestHypothesisStrategies.test_port_numbers_bounds_allow_zerocCs4zt|�t|�WdStytd�|���w)zK
            hostname_labels() generates IDN host name labels.
            �Invalid IDN label: {!r}N)rr�UnicodeErrorrr�r�labelr!r!r"�test_hostname_labels_valid_idnTs�z7TestHypothesisStrategies.test_hostname_labels_valid_idn�
)Zmax_examplesc	Csztdd��}td|��(|�t��}z
t|�t|�Wnty*td�|���wWd�dS1s6wYdS)z�
            hostname_labels() handles case where idna_text() generates text
            that encoded to punycode ends up as longer than allowed.
            cSsd|S)N�ár!)r&r$r%r!r!r"�mock_idna_textiszWTestHypothesisStrategies.test_hostname_labels_long_idn_punycode.<locals>.mock_idna_textzhyperlink.hypothesis.idna_textr.N)	rrr&rrrr/rr)rr	r5r1r!r!r"�&test_hostname_labels_long_idn_punycode`s	
	���"�z?TestHypothesisStrategies.test_hostname_labels_long_idn_punycodeF)�	allow_idncCs6zt|�|�d�WdStytd�|���w)zO
            hostname_labels() generates a ASCII host name labels.
            �asciizInvalid ASCII label: {!r}N)rrr/rrr0r!r!r"� test_hostname_labels_valid_ascii}s�z9TestHypothesisStrategies.test_hostname_labels_valid_asciicCsDz|�d�D]}t|�qt|�WdSty!td�|���w)zA
            hostnames() generates a IDN host names.
            �.zInvalid IDN host name: {!r}N)�splitrrr/rr�r�hostnamer1r!r!r"�test_hostnames_idn�s
��z+TestHypothesisStrategies.test_hostnames_idn)�allow_leading_digitcC�|�||�t�k�dS)z}
            hostnames(allow_leading_digit=False) generates a IDN host names
            without leading digits.
            N�Z
assertTrue�lstripr�rr=r!r!r"�test_hostnames_idn_nolead��z2TestHypothesisStrategies.test_hostnames_idn_noleadcCsFz|�d�D]}t|�q|�d�WdSty"td�|���w)zC
            hostnames() generates a ASCII host names.
            r:r8zInvalid ASCII host name: {!r}N)r;rrr/rrr<r!r!r"�test_hostnames_ascii�s
��z-TestHypothesisStrategies.test_hostnames_ascii)r?r7cCr@)z�
            hostnames(allow_leading_digit=False, allow_idn=False) generates
            ASCII host names without leading digits.
            NrArCr!r!r"�test_hostnames_ascii_nolead�rEz4TestHypothesisStrategies.test_hostnames_ascii_noleadcCsPd�|�}z|�d�Wntytd�|���w|D]}|�d|�qdS)zM
            paths() generates sequences of URL path components.
            �/zutf-8zInvalid URL path: {!r}z#/?N)�joinrr/rrZassertNotIn)r�pathr Zsegmentr!r!r"�
test_paths�s
��z#TestHypothesisStrategies.test_pathscC�|�|t�dS)z?
            encoded_urls() generates EncodedURLs.
            N)�assertIsInstancer�rZurlr!r!r"�test_encoded_urls��z*TestHypothesisStrategies.test_encoded_urlscCrL)z?
            decoded_urls() generates DecodedURLs.
            N)rMrrNr!r!r"�test_decoded_urls�rPz*TestHypothesisStrategies.test_decoded_urlsN)�__name__�
__module__�__qualname__�__doc__rrr#r	r'rr,r-rr2rr6r9rr>rDrFrGrrKrrOrrQr!r!r!r"r(s>




	







r)$rUZ
hypothesis�ImportError�stringr�typingrrZ
unittest.mockrZmockrrZhypothesis.strategiesrr	Zidnar
rrr�commonr�rrrrrrrrrrrrr!r!r!r"�<module>s*��,