+
    Bi%                     H   ^ RI t ^ RIHt ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt	^ RI
t	^ RIt	^ RIt^ RIt^ RIt]P                   ! R4        ! R R] P"                  4      t ! R R	] P"                  4      t ! R
 R] P"                  4      t]R8X  d   ] P,                  ! 4        R# R# )    N)support)	os_helper)socket_helpernetworkc                   2   a  ] tR t^t o R tR tR tRtV tR# )URLTimeoutTestc                N    \         P                  ! \        P                  4       R # N)socketsetdefaulttimeoutr   INTERNET_TIMEOUTselfs   &*/usr/lib/python3.14/test/test_urllibnet.pysetUpURLTimeoutTest.setUp   s      !9!9:    c                2    \         P                  ! R 4       R # r
   )r   r   r   s   &r   tearDownURLTimeoutTest.tearDown   s      &r   c                   V P                  \        P                  P                  4       \        P                  P                  \        P                  4      P                  p\        P                  ! V4      ;_uu_ 4        \        P                  P                  \        P                  4      pVP                  4        R R R 4       R #   + '       g   i     R # ; ir
   )
addCleanupurllibrequest
urlcleanupparseurlparser   TEST_HTTP_URLnetlocr   transient_interneturlopenread)r   domainfs   &  r   testURLreadURLTimeoutTest.testURLread   s{    112&&w'<'<=DD--f55&&w'<'<=AFFH 6555s   ?>CC	 N)	__name__
__module____qualname____firstlineno__r   r   r%   __static_attributes____classdictcell____classdict__s   @r   r   r      s     ;' r   r   c                      a  ] tR t^&t o RtRtR t]P                  R 4       t	R t
R tR tR tR	 t]P                   ! R
4      R 4       tRtV tR# )urlopenNetworkTestsa  Tests urllib.request.urlopen using the network.

These tests are not exhaustive.  Assuming that testing using files does a
good job overall of some of the basic interface features.  There are no
tests exercising the optional 'data' and 'proxies' arguments.  No tests
for transparent redirection have been written.

setUp is not used for always constructing a connection to
http://www.pythontest.net/ since there a few tests that don't use that address
and making a connection is expensive enough to warrant minimizing unneeded
connections.

http://www.pythontest.net/c                X    V P                  \        P                  P                  4       R # r
   r   r   r   r   r   s   &r   r   urlopenNetworkTests.setUp7       112r   c              /  ,  "   V^ ,          p\         P                  ! V4      ;_uu_ 4        \        P                  P                  ! V/ VB p Vx  VP                  4         RRR4       R#   TP                  4        i ; i  + '       g   i     R# ; i5ir   N)r   r    r   r   r!   close)r   argskwargsresourcers   &*,  r   r!   urlopenNetworkTests.urlopen;   sk     7--h77&&77A	 87
 	 877s4   (B!B A+B !
B+A==B  B		Bc                    V P                  V P                  4      ;_uu_ 4       pR F  pV P                  W4       K  	  V P                  VP	                  4       R4       RRR4       R#   + '       g   i     R# ; i)r"   zcalling 'read' failedN)r"   readline	readlinesfilenor9   infogeturl)r!   urlassertHasAttr
assertTruer"   )r   open_urlattrs   &  r   
test_basicurlopenNetworkTests.test_basicE   sW    \\$((##x+""82+ OOHMMO-DE	 $###s   ;A))A:	c                   V P                  V P                  4      ;_uu_ 4       pV P                  VP                  4       \        R 4       V P                  VP                  4       \        R4       RRR4       R#   + '       g   i     R# ; i)z readline did not return a stringzreadlines did not return a listN)r!   rE   assertIsInstancer@   bytesrA   list)r   rH   s   & r   test_readlines"urlopenNetworkTests.test_readlinesM   sd    \\$((##x!!("3"3"5u"DF!!("4"4"6"CE $###s   AA99B
	c                <   V P                  V P                  4      ;_uu_ 4       pVP                  4       pV P                  V\        P
                  P                  R 4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)zEobject returned by 'info' is not an instance of email.message.MessagehtmlN)	r!   rE   rC   rM   emailmessageMessageassertEqualget_content_subtype)r   rH   info_objs   &  r   	test_infourlopenNetworkTests.test_infoU   so    \\$((##x}}H!!(EMM,A,A#FG X99;VD $###s   AB

B	c                    V P                  V P                  4      ;_uu_ 4       pVP                  4       pV P                  W P                  4       R R R 4       R #   + '       g   i     R # ; ir
   )r!   rE   rD   rW   )r   rH   
gotten_urls   &  r   test_geturlurlopenNetworkTests.test_geturl^   sD    \\$((##x!*JZ2 $###s   ,AA+	c                D   V P                   R ,           p\        P                  ! V4      ;_uu_ 4        V P                  \        P
                  P                  4      ;_uu_ 4       p\        P                  P                  V4      ;_uu_ 4         RRR4       RRR4       V P                  XP                  P                  R4       VP                  P                  4        RRR4       R#   + '       g   i     Lb; i  + '       g   i     Lm; i  + '       g   i     R# ; i)XXXinvalidXXXNi  )rE   r   r    assertRaisesr   errorURLErrorr   r!   rW   	exceptioncoder9   )r   URLes   &  r   test_getcode urlopenNetworkTests.test_getcoded   s    hh(--c22""6<<#8#899Q^^++C00 1 : Q[[--s3KK 3200 :9 322s<   2D$(C;	C(C;	AD(C83C;	;DDD	walltimec                b   R p \         P                  ! V4       V P                  RV,          4       RpV P	                  \        VR7      ;_uu_ 4        \
        P                  P                  RP                  V4      4       RRR4       R#   \         d     Lgi ; i  + '       g   i     R# ; i)zsadflkjsasf.i.nvali.d.z&%r should not resolve for test to workzuopening an invalid URL did not raise OSError; can be caused by a broken DNS server (e.g. returns 404 or hijacks page)msgz
http://{}/N)	r   gethostbynameskipTestOSErrorrb   r   r   r!   format)r   bogus_domainfailure_explanations   &  r   test_bad_address$urlopenNetworkTests.test_bad_addressn   s    , 0		S  . MMB\QR D w,?@@NN""<#6#6|#DE A@  	 		 A@@s   B /BBBB.	r'   N)r(   r)   r*   r+   __doc__rE   r   
contextlibcontextmanagerr!   rJ   rP   rZ   r^   ri   r   requires_resourceru   r,   r-   r.   s   @r   r1   r1   &   sm      'C3  FEE3  z*$F +$Fr   r1   c                      a  ] tR t^t o RtR t]P                  R 4       tR t	R t
R tRt]P                  ! R4      R	 4       tR
 tRtV tR# )urlretrieveNetworkTestsz3Tests urllib.request.urlretrieve using the network.c                X    V P                  \        P                  P                  4       R # r
   r4   r   s   &r   r   urlretrieveNetworkTests.setUp   r6   r   c              /  J  "   V^ ,          p\         P                  ! V4      ;_uu_ 4        \        P                  P                  ! V/ VB w  rE WE3x  \
        P                  ! V4        RRR4       R#   \
        P                  ! T4       i ; i  + '       g   i     R# ; i5ir8   )r   r    r   r   urlretriever   unlink)r   r:   r;   r<   file_locationrC   s   &*,   r   r   #urlretrieveNetworkTests.urlretrieve   s|     7--h77"(.."<"<d"Mf"MM0#))  / 87
   / 877s4   (B##BA4B*
B#4BBB 		B#c           	        V P                  V P                  4      ;_uu_ 4       w  rV P                  \        P                  P                  V4      R 4       \        VR4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z9file location returned by urlretrieve is not a valid pathrbz=reading from the file location returned by urlretrieve failedN)r   logorG   ospathexistsopenr"   r   r   rC   r$   s   &   r   rJ   "urlretrieveNetworkTests.test_basic   s    dii((,A]OOBGGNN=9 <? @mT**a +9 : + )( +* )((s$   AB0*!B	B0B-(B00C	c           	        V P                  V P                  \        P                  4      ;_uu_ 4       w  rV P	                  V\        P                  4       V P                  \        P                  P                  V4      4       \        VR 4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r   z"reading from temporary file failedN)r   r   r   TESTFNrW   rG   r   r   r   r   r"   r   s   &   r   test_specified_path+urlretrieveNetworkTests.test_specified_path   s    dii'..0 03HM]I,<,<=OOBGGNN=9:mT**a*NO +	0 0 +*	0 0 0s$   A%C!C	9CCCC/	c                    V P                  V P                  4      ;_uu_ 4       w  rV P                  V\        P                  P
                  R 4       RRR4       R#   + '       g   i     R# ; i)z0info is not an instance of email.message.MessageN)r   r   rM   rT   rU   rV   )r   r   rC   s   &  r   test_header#urlretrieveNetworkTests.test_header   sK    dii((,A]!!$(=(="TV )(((s   .AA-	r2   rk   c                0   V P                  V P                  4      ;_uu_ 4       w  rVP                  R 4      pRp \        P                  ! W44       RRR4       R#   \
         d    T P                  RT,          4        L/i ; i  + '       g   i     R# ; i)Datez%a, %d %b %Y %H:%M:%S GMTzDate value not in %r formatN)r   r   gettimestrptime
ValueErrorfail)r   r   fileheaders	datevalue
dateformats   &    r   test_data_header(urlretrieveNetworkTests.test_data_header   sz    dii((,H]#/I4JFi4	 )(
  F		7*DEF )((s(   BA#B>B BBB	c                ,  a	 . o	V	3R  lpV P                  V P                  VR7      ;_uu_ 4       w  r#\        VR,          4      pRRR4       \        S	4      pV P	                  \        S	4      ^RR7       V P                  S	^ ,          ^ ,          ^ 4       V P	                  S	^ ,          ^,          ^ RV,          R7       V P                  S	^ ,          ^,          X4       V P                  S	R	,          ^,          V4       S	 UUu0 uF  w  rgqgkK	  	  pppV P                  S	^ ,          ^,          0VRV,          R7       V P                  S	R	,          ^ ,          S	^ ,          ^,          ,          VRV,          R7       R#   + '       g   i     ELA; iu uppi )
c                 .   < SP                  WV34       R # r
   )append)blocks
block_size
total_sizerecordss   &&&r   recording_reporthookEurlretrieveNetworkTests.test_reporthook.<locals>.recording_reporthook   s    NNF
;<r   )
reporthookzContent-LengthNzKThere should always be two calls; the first one before the transfer starts.rm   zblock size can't be 0 in %szblock sizes in %s must be equalz9number of blocks * block size must be >= total size in %s)r   r   intreprassertGreaterlenrW   assertGreaterEqual)
r   r   r   r   expected_sizerecords_repr_r   block_sizesr   s
   &        @r   test_reporthook'urlretrieveNetworkTests.test_reporthook   st   	= dii4HII N,,< =>M J G}3w< 1N 	OA*71:a=!<|K 	 	MA6Q7:AB'&6aQz'B'!*Q-+>M 	 	OAwqz!} <m%79E%F 	  	G! JII Cs   E<F<F	r'   N)r(   r)   r*   r+   rw   r   rx   ry   r   rJ   r   r   r   r   rz   r   r   r,   r-   r.   s   @r   r|   r|      sj     =3 0 0:PV (Dz*F +FG Gr   r|   __main__)unittesttestr   test.supportr   r   rx   r   urllib.errorr   urllib.parseurllib.requestr   email.messagerT   r   requiresTestCaser   r1   r|   r(   mainr'   r   r   <module>r      s      " &      	      X&& &mF(++ mF`MGh// MG` zMMO r   