Ë Åü(_çãó—dZ ddlZ[ddlmZddlmZmZ ddlmZddlm Z m Z ddl mZmZddlmZmZmZd d lmZd d lmZmZd d 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„«Z ee ««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×%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..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]}|j d|«Œ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 Úidnar r r rÚcommonrÚrrrrrrrrrrrrrCr,r$úrysðñðP3Ûàõß%ðÝ'÷+ß:çBÑBå)ß)÷ ÷ õ ôn3Ð#4õn3øð- òßðûðò Ùð ús"„A9˜A(Á( A6Á5A6Á9BÂB