python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_robotparser.cpython-311.opt-1.pyc

e,HddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZm
Z
GddZGdd	eejZGd
deejZGdd
eejZGddeejZGddeZGddeejZGddeejZGddeZGddeejZGddeejZGddeejZGddeejZGd d!eZGd"d#eejZGd$d%eejZGd&d'eejZGd(d)eejZ Gd*d+eejZ!Gd,d-eejZ"Gd.d/eZ#ej$ej%d0Gd1d2ejZ&ej'Gd3d4ejZ(e)d5krej*dSdS)6N)support)
socket_helper)threading_helper)BaseHTTPRequestHandler
HTTPServerc@eZdZdZdZgZgZdZdZdZ	dZ
dZdZdS)	
BaseRobotTesttest_robotparserNctj|j}tj|_|j|dSN)	ioStringIO
robots_txt	readlinesurllibrobotparserRobotFileParserparserparse)selfliness  I/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_robotparser.pysetUpzBaseRobotTest.setUpsQDO,,6688(88::%     cPt|tr	|\}}||fS|j|fSr
)
isinstancetupleagentrurlrs   rget_agent_and_urlzBaseRobotTest.get_agent_and_urls3c5!!	JE3#:z3rc|jD]w}||\}}|||5||j||dddn#1swxYwYxdSN)r!r)goodr"subTest
assertTruer	can_fetchr s   rtest_good_urlszBaseRobotTest.test_good_urlss9	C	CC//44JE3#U33
C
C 5 5eS A ABBB
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C	C	C/A44A8	;A8	c|jD]w}||\}}|||5||j||dddn#1swxYwYxdSr$)badr"r&assertFalserr(r s   r
test_bad_urlszBaseRobotTest.test_bad_urls$s8	D	DC//44JE3#U33
D
D  !6!6uc!B!BCCC
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D	D	Dr*cj||j|jdSr
)assertEqualr	site_mapsrs rtest_site_mapszBaseRobotTest.test_site_maps*s...00$.AAAAAr)
__name__
__module____qualname__rrr%r,r1rr"r)r.r3rrr	r	sJE
D
CI!!!
CCCDDDBBBBBrr	c"eZdZdZddgZgdZdS)UserAgentWildcardTestzUser-agent: *
Disallow: /cyberworld/map/ # This is an infinite virtual URL space
Disallow: /tmp/ # these will soon disappear
Disallow: /foo.html
    /
/test.html)/cyberworld/map/index.htmlz/tmp/xxx	/foo.htmlNr4r5r6rr%r,r7rrr9r9.s,J
D
A
A
ACCCrr9c eZdZdZgdZdgZdS)CrawlDelayAndCustomAgentTestz# robots.txt for http://www.example.com/

User-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

# Cybermapper knows where to go.
User-agent: cybermapper
Disallow:
    )r:r;)cybermapperr<r<Nr>r7rrr@r@9s+JNMMD'
(CCCrr@c(eZdZdZddgZdgZddgZdS)SitemapTesta# robots.txt for http://www.example.com/

User-agent: *
Sitemap: http://www.gstatic.com/s2/sitemaps/profiles-sitemap.xml
Sitemap: http://www.google.com/hostednews/sitemap_index.xml
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

    r:r;r<z7http://www.gstatic.com/s2/sitemaps/profiles-sitemap.xmlz2http://www.google.com/hostednews/sitemap_index.xmlN)r4r5r6rr%r,r1r7rrrCrCJs7	J
D'
(CJEGIIIrrCceZdZdZgZgdZdS)RejectAllRobotsTestz(# go away
User-agent: *
Disallow: /
    )r<r:/tmp/Nr>r7rrrErE[s'J
D
6
6
6CCCrrEceZdZdZdZdZdS)BaseRequestRateTestNcr|j}|j|jzD]}||\}}|||5||||j||}|||j|jo||tj
j||j|jj||j
|jj
dddn#1swxYwY dSr$)rr%r,r"r&r0crawl_delayrequest_rateassertIsInstancerrRequestRaterequestsseconds)rrr!rparsed_request_rates     rtest_request_ratez%BaseRequestRateTest.test_request_rateis9tx'		C//44JE3#U33

  !3!3E!:!:D<LMMM&,&9&9%&@&@#  !4d6GHHH$0))+*6$$+4)2$$+3)1














		s	CD**D.	1D.	)r4r5r6rKrJrQr7rrrHrHes-LKrrHceZdZdZdgZdS)
EmptyFileTestr
z/fooN)r4r5r6rr%r7rrrSrSsJ8DDDrrSc^eZdZdZdZejddZdZ	dgZ
gdZdS)	CrawlDelayAndRequestRateTestzUser-agent: figtree
Crawl-delay: 3
Request-rate: 9/30
Disallow: /tmp
Disallow: /a%3cd.html
Disallow: /a%2fb.html
Disallow: /%7ejoe/index.html
    figtree	)rVr=)/tmpz	/tmp.html/tmp/a.html/a%3cd.html/a%3Cd.htmlz/a%2fb.htmlz/~joe/index.htmlN)r4r5r6rrrrrMrKrJr%r,r7rrrUrUsRJ
E%11!R88LK$%D...CCCrrUceZdZdZdS)DifferentAgentTestzFigTree Robot libwww-perl/5.04Nr4r5r6rr7rrr_r_s,EEErr_c$eZdZdZdgZgdZdZdS)InvalidRequestRateTestzUser-agent: *
Disallow: /tmp/
Disallow: /a%3Cd.html
Disallow: /a/b.html
Disallow: /%7ejoe/index.html
Crawl-delay: 3
Request-rate: 9/banana
    rZ)rFr[r\r]z	/a/b.htmlz/%7Ejoe/index.htmlrYN)r4r5r6rr%r,rJr7rrrbrbs4J
8D!!!CKKKrrbceZdZdZdgZgZdS)InvalidCrawlDelayTestz2User-Agent: *
Disallow: /.
Crawl-delay: pears
    r=Nr>r7rrrdrds#J

=D
CCCrrdc"eZdZdZdZdgZdgZdS)AnotherInvalidRequestRateTestzeUser-agent: Googlebot
Allow: /folder1/myfile.html
Disallow: /folder1/
Request-rate: whale/banana
    	Googlebot/folder1/myfile.html/folder1/anotherfile.htmlNr4r5r6rrr%r,r7rrrfrfs,J
E"#D&
'CCCrrfceZdZdZdZdgZdS)UserAgentOrderingTestzMUser-agent: Googlebot
Disallow: /

User-agent: Googlebot-Mobile
Allow: /
    rgz/something.jpgN)r4r5r6rrr,r7rrrlrls$J
E
CCCrrlceZdZdZdS)UserAgentGoogleMobileTestzGooglebot-MobileNr`r7rrrnrnsEEErrnc"eZdZdZdZdgZdgZdS)GoogleURLOrderingTestzJUser-agent: Googlebot
Allow: /folder1/myfile.html
Disallow: /folder1/
    	googlebotrhriNrjr7rrrprps,J

E"#D&
'CCCrrpceZdZdZdgZdgZdS)DisallowQueryStringTestz2User-agent: *
Disallow: /some/path?name=value
    
/some/pathz/some/path?name=valueNr>r7rrrsrss&J
>D"
#CCCrrsceZdZdZdgZdgZdS)UseFirstUserAgentWildcardTestzNUser-agent: *
Disallow: /some/path

User-agent: *
Disallow: /another/path
    z
/another/pathrtNr>r7rrrvrvs&J
D.CCCrrvceZdZdZdgZdgZdS)EmptyQueryStringTestz>User-agent: *
Allow: /some/path?
Disallow: /another/path?
    z/some/path?z/another/path?Nr>r7rrrxrxs&J

?D
CCCrrxcZeZdZdZejddZdZddgZ	dgZ
dS)	DefaultEntryTestzOUser-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/
    rYr:r;r<N)r4r5r6rrrrMrKrJr%r,r7rrrzrzsFJ%11!R88LKD'
(CCCrrzceZdZdZdZdZdS)StringFormattingTestzUser-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

# Cybermapper knows where to go.
User-agent: cybermapper
Disallow: /some/path
    zxUser-agent: cybermapper
Disallow: /some/path

User-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/c`|t|j|jdSr
)r0strrexpected_outputr2s rtest_string_formattingz+StringFormattingTest.test_string_formatting*s+T[))4+?@@@@@rN)r4r5r6rrrr7rrr~r~s6	JOAAAAArr~ceZdZdZdZdS)RobotHandlerc2|dddS)NizForbidden access)
send_errorr2s rdo_GETzRobotHandler.do_GET0s/00000rcdSr
r7)rformatargss   rlog_messagezRobotHandler.log_message3srN)r4r5r6rrr7rrrr.s2111




rrz&Socket server requires working socket.c:eZdZdZdZejdZdS)PasswordProtectedSiteTestCasec4|tjjt	t
jdft|_tj
d|jjddi|_d|j_
|jdS)NrzHTTPServer serving
poll_intervalg{Gz?)nametargetkwargsT)
addCleanuprrequest
urlcleanuprrHOSTrserver	threadingThread
serve_forevertdaemonstartr2s rrz#PasswordProtectedSiteTestCase.setUp=s~1222 -"4a!8,GG!%;,$D)
+++
rc|j|j|jdSr
)rshutdownrjoinserver_closer2s rtearDownz&PasswordProtectedSiteTestCase.tearDownMs?


  """""rcX|jj}dtjzdzt	|dz}|dz}t
j}|||	|
|d|dS)Nzhttp://:r|z/robots.txt*)rserver_addressrrrrrrset_urlreadr-r()raddrr!
robots_urlrs     rtestPasswordProtectedSitez7PasswordProtectedSiteTestCase.testPasswordProtectedSiteRs{)-,,s2Sa\\A=(
#3355s


))#z::;;;;;rN)r4r5r6rrrreap_threadsrr7rrrr7sQ ###
"<<#"<<<rrcjeZdZdZdeZedZdZdZ	dZ
dZdS)	NetworkTestCasezhttp://www.pythontest.net/z{}elsewhere/robots.txtctjdtj|j5t
j|j|_	|j	
ddddS#1swxYwYdS)Nnetwork)rrequiresrtransient_internetbase_urlrrrrrr)clss r
setUpClasszNetworkTestCase.setUpClasscs###

-cl
;
;		+;;CNKKCJJOO																		sAA>>BBcd|j|tj|dsdndS)Nz{}{}{}r|r:r
)rrospathsplitext)rrs  rr!zNetworkTestCase.urljs?M4BG,<,<T,B,B1,E!M2

	
rc||jj||jj||jd||jd||jddS)Nrr)r-rdisallow_all	allow_all
assertGreatermtimerJrKr2s r
test_basiczNetworkTestCase.test_basicos1222.///4;,,..222005566611#6677777rc||jd|d||jd|j||jd|d||jd|d||jd|d||jd|jdS)Nr	elsewhereNutchbrianwebstats)r'rr(r!r-rr2s rtest_can_fetchzNetworkTestCase.test_can_fetchvs--c488K3H3HIIJJJ..w
FFGGG..w8I8IJJKKK..w8L8LMMNNN..sDHHZ4H4HIIJJJ--c4=AABBBBBrctj|d}|||j||j|	|
d||d||
ddS)Nzi-robot.txtrr)rrrr!rr'rr-rr0rassertIsNonerJrK)rrs  r
test_read_404zNetworkTestCase.test_read_404~s#33DHH]4K4KLL


())),---+++&,,S11222&--c2233333rN)r4r5r6rrrclassmethodrr!rrrr7rrrr]s,H)00::J[



888CCC44444rr__main__)+rrrunittesturllib.robotparserrtestrtest.supportrrhttp.serverrrr	TestCaser9r@rCrErHrSrUr_rbrdrfrlrnrprsrvrxrzr~r
skipUnlesshas_socket_supportrrequires_working_socketrr4mainr7rr<module>rs.								&&&&&&))))))::::::::BBBBBBBBDBBBBBM8+<BBB)))))=(2C)))"GGGGG-!2GGG"77777-):777-8'):
.....#68I...$-----5---




]H,=


 	
	
	
	
	
M8+<	
	
	

(
(
(
(
(M83D
(
(
(M8+< 5
(
(
(
(
(M8+<
(
(
($$$$$mX->$$$




M83D


=(*;
)
)
)
)
)*H,=
)
)
)AAAAA=(*;AAA4




)


,<<<<<H$5<<	<D! ""'4'4'4'4'4h''4'4#"'4RZHMOOOOOr