python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_http_cookies.cpython-312.opt-2.pyc

ΑeJddlZddlZddlZddlmZddlZGddejZGddejZdZ	e
dk(rejyy)	N)cookiescfeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZy)CookieTestsc
ddddddddd	d
idddd
d	diddddddidddddddddddjddg}|D]}tj}|j|d|j	t||d |j	|j
d!|d"t|d#jD]$\}}|j	||j|&y)$Nzchips=ahoy; vienna=fingerahoyfinger)chipsviennaz,<SimpleCookie: chips='ahoy' vienna='finger'>z0Set-Cookie: chips=ahoy
Set-Cookie: vienna=finger)datadictreproutputz)keebler="E=mc2; L=\"Loves\"; fudge=\012;"keeblerzE=mc2; L="Loves"; fudge=
;z5<SimpleCookie: keebler='E=mc2; L="Loves"; fudge=\n;'>z5Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"z
keebler=E=mc2zE=mc2z<SimpleCookie: keebler='E=mc2'>zSet-Cookie: keebler=E=mc2zkey:term=value:termzkey:termz
value:termz%<SimpleCookie: key:term='value:term'>zSet-Cookie: key:term=value:termza=b; c=[; d=r; f=hb[rh)acdfz'<SimpleCookie: a='b' c='[' d='r' f='h'>
)zSet-Cookie: a=bzSet-Cookie: c=[zSet-Cookie: d=rzSet-Cookie: f=hrr
)seprr)
joinrSimpleCookieloadassertEqualr
rsorteditemsvalue)selfcasescaseCkvs      J/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_http_cookies.py
test_basiczCookieTests.test_basics90$x8CJ
L
D"ABQQ
S%'*62
4, <0<8:- cs<A))%	

7&
P	0D$$&A
FF4< T!Wd6l3QXX$X/h@tF|1134
01  1Q/
0	0ctj}|jd|j|djd|j|ddd|j|ddd|j|jdgd|j|j
d	|j|j
dgd
y)Nz/Customer="WILE_E_COYOTE"; Version=1; Path=/acmeCustomer
WILE_E_COYOTEversion1path/acme0Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
        // end hiding -->
        </script>
        
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
        // end hiding -->
        </script>
        rrrrr r	js_outputr!r$s  r'	test_loadzCookieTests.test_load=s  "	@A:,,o>:y137:v.86(+>	@)	
	
fX.1	
r)cztj}d|d<|j|jdgdy)Nzsome,funky;stuffvalz(Set-Cookie: val="some\054funky\073stuff"rrrrr6s  r'test_extended_encodez CookieTests.test_extended_encodeVs9
  "%%5'*8	:r)ctjd}d|dd<|j|jj	dtj}|jd|j
|dddtj}|jd|j
|ddd	tjd}d
|dd<|j
|jdy)
NCustomer="WILE_E_COYOTE"rr+expiresGMTz3Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMTzWed, 01 Jan 2010 00:00:00 GMTz1Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMTzWed, 01 Jan 98 00:00:00 GMT
max-agez0Set-Cookie: Customer="WILE_E_COYOTE"; Max-Age=10)rr
assertTruerendswithrrr6s  r'test_special_attrszCookieTests.test_special_attrs^s  !;<#$*
i 
++E23
  "	DE:y18	:  "	BC:y16	8
  !;<#%*
i K	Mr)ctjd}d|dd<d|dd<|j|jdy)Nr=Tr+securehttponlyz6Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Securer:r6s  r'test_set_secure_httponly_attrsz*CookieTests.test_set_secure_httponly_attrsusI  !;<"&*
h$(*
j!D	Fr)chgd}|D]}|j|5tjd}||dd<|j|j	d|ztj}|jd|z|j|dd|dddy#1swYxYw)N)StrictLaxstrictlax)r9r=r+samesitez1Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%sz%Customer="WILL_E_COYOTE"; SameSite=%s)subTestrrrrr)r!samesite_valuesr9r$s    r'test_samesite_attrszCookieTests.test_samesite_attrs|s<"		AC#&
A(()CD,/*
j)  G#MO((*>DE  :z!:C@
A
A		A
A
AsBB((B1	ctj}|jd|j|dd|j|ddy)Nzeggs=scrambled; Path=/baconeggsrGrF)rrrassertFalser6s  r')test_secure_httponly_false_if_not_presentz5CookieTests.test_secure_httponly_false_if_not_presentsK  "	,-6:./68,-r)ctj}|jd|j|dd|j|ddy)Nz-eggs=scrambled; httponly; secure; Path=/baconrSrGrF)rrrrBr6s  r'$test_secure_httponly_true_if_presentz0CookieTests.test_secure_httponly_true_if_presentsG  "	>?&	*-.&	(+,r)c
tj}|jd|j|dd|j|dd|j	|ddd|j	|dddy)Nz5eggs=scrambled; httponly=foo; secure=bar; Path=/baconrSrGrFfoobar)rrrrBrr6s  r''test_secure_httponly_true_if_have_valuez3CookieTests.test_secure_httponly_true_if_have_values}
  "	FG&	*-.&	(+,	
6:.668,e4r)ctj}|jd|j|j	dy)Nz=eggs  =  scrambled  ;  secure  ;  path  =  bar   ; foo=foo   zASet-Cookie: eggs=scrambled; Path=bar; Secure
Set-Cookie: foo=foo)rrrrrr6s  r'test_extra_spaceszCookieTests.test_extra_spacess7  "	NOQ	Sr)ctj}|jd|j|djd|j|ddd|j|ddd|j|jdgd|j|j
d	|j|j
dgd
y)Nz3Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"r+r,r-r.r/r0r1r2r3r4r6s  r'test_quoted_metazCookieTests.test_quoted_metas  "	DE:,,o>:y137:v.86(+K	M)	
	
fX.1	
r)ctj}dD]N}|j||jt	|i|j|jdPy)N)
z]foo=xz[foo=xz
blah]foo=xz
blah[foo=xzSet-Cookie: foo=barzSet-Cookie: foozfoo=bar; bazzbaz; foo=barzsecure;foo=barzVersion=1;foo=bar)rrrrrr)r!r$ss   r'test_invalid_cookiesz CookieTests.test_invalid_cookiessX  "9	-A
FF1IT!Wb)QXXZ,
	-r)cd}d|z}tj}|j||j|j	|ttjdzD]g}|j|5t
jt
j||}|j|j	|dddiy#1swYtxYw)Nz/Customer="WILE_E_COYOTE"; Path=/acme; Version=1zSet-Cookie: %sproto)protocol)rrrrrrangepickleHIGHEST_PROTOCOLrOloadsdumps)r!rawdataexpected_outputr$rgC1s      r'test_picklezCookieTests.test_picklesC*W4  "	w_5622Q67	?EE*
?\\&,,q5"AB  o>
?
?	?
?
?s
>ACC	cd}tj}|jtj5|j	|dddy#1swYyxYw)Nz
a=b; c,d=e)rrassertRaisesCookieErrorr)r!rnr$s   r'test_illegal_charszCookieTests.test_illegal_charssI  "


w22
3	
FF7O			sAActj}d|d<|jt|ddd|dd<|jt|ddy)N©rYzSet-Cookie: foo="\251"u
comment ©commentz.Set-Cookie: foo="\251"; Comment="comment \251")rrrstr)r!rs  r'test_comment_quotingz CookieTests.test_comment_quotings\  "'%QuX(AB:%%M>	
r)N)__name__
__module____qualname__r(r7r;rDrHrQrUrWr[r]r_rcrqrurzr)r'rr
sR/0b
2:M.FA.-
5S
2	-?
r)rcPeZdZ	dZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
y)
MorselTestsctj}|j|j|j|j|j|j
|j
|jtjjj|jD]\}}|j
|d|yNra)
rMorselassertIsNonekeyr coded_valuerkeys	_reservedr)r!morselrr9s    r'
test_defaultszMorselTests.test_defaultss!&**%&,,'&,,-(@(@(E(E(GH	+HCS"c*	+r)cxtj}|jD]*}|j|j	|d|z||<,|jD]}|j||d|zdj
D]1}|jtj|j|d|z3y)N%s_valuezthe holy hand grenade)
rrrrB
isReservedKeyrsplitrsrt__setitem__)r!Mis   r'test_reserved_keyszMorselTests.test_reserved_keyssNN	"AOOAOOA./>AaD	"	3AQqT:>2	3)..0	@Ag11mmQ
Q
@	@r)c	tj}|jD]5}|jtj|j
|d|zd|z7dj
D]}d|d<|j|d|zd|z|j|j||j|jd|z|j|jd|z|j|jd|dd|zd	d
|dd|zd}|j|j|dD]5}|jtj|j
|d|zd|z7y)
Nrz(thou cast _the- !holy! ^hand| +*grenade~z/foor/z%s_valz%s_coded_valzSet-Cookie: =z; Path=/fooz^
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "zB; Path=/foo";
        // end hiding -->
        </script>
        )zfoo barzfoo@bar)
rrrrsrtsetrrrr rrr5)r!rrexpected_js_outputs    r'test_setterzMorselTests.test_setterseNN	HAg11eeQ
Q
Q
H	H<AAC	@AAfI
EE!X\>A#56QUUA&QWWhl3Q]]NQ,>?
23^a5GH
J.1$
"&
Q[[],>?%	@&(	HAg11eeQ
Q
Q
H	Hr)cRtj}|jt5d|_ddd|jt5d|_ddd|jt5d|_dddy#1swYTxYw#1swY;xYw#1swYyxYwr)rrrsAttributeErrorrr rr!rs  r'test_set_propertieszMorselTests.test_set_properties$s!


~
.	FJ	


~
.	FL	


~
.	$!#F	$	$						$	$s#BB4BBBB&c
d}ddddd}tj}|j||j|tj}|j||j||j	||k(|j||k7d}|D]x}|j
|5tj}|j||j||j||k(|j	||k7dddztj}|j||j|d|d	<|j||k(|j	||k7|jtjd
k(|j	tjd
k7|jtjdk(|j	tjdk7ttjj}|jtj|k(|j	tj|k7tj}|j||j||j	|t|k(|j|t|k7y#1swYdxYw)N)rr "value"/rYexample.com)r/rxdomainr-))rr mismatch)rrr)rr rrZrxrera)
rrupdaterrBrTrOlistrr)	r!	base_caseattribsmorsel_amorsel_br"case_brrs	         r'test_eqzMorselTests.test_eq-sp/	#	
>># i >># i H,-X-.

	6Ff%
6">>+(f%  X!56H 45
6
6	6>># i #X-.H,-	
)Q./(A-.)R/0(B./W^^%++-.)U23(E12!

I

g$v,./4</09
6
6s
2AK88L	ctj}|jddd|jddd|j	}|j|tj|j
|||j||t	j|}|j|tj|j
|||j||y)NrYrZbazrr-rx)rrrrcopyassertIsInstanceassertIsNotr)r!rrs   r'	test_copyzMorselTests.test_copyas>>#UE5)
	==?h78,8,99X&h78,8,r)c^tj}d|d<|j|ddd|d<|j|ddd|d<|j|dd|jtj5d	|d
<ddd|jd
|y#1swYxYw)Nrr>rVersionr-rDOMAINrr invalid)rrrrsrtassertNotInrs  r'test_setitemzMorselTests.test_setitemrs!y	*A.y	*A.(x)=9


w22
3	( 'F9	(F+	(	(sB##B,cNtj}|jddd|j|j	ddd|j|dd|j|j	ddd|j|d	d|j|j	d
dd|j|dd|jtj5|j	ddddd|jd|y#1swYxYw)
Nrr)rr-r>r rarrer-rrr)rrrr
setdefaultrsrtrrs  r'test_setdefaultzMorselTests.test_setdefaults!

#
	
	
**9g>C	*B/**9a8!<	*A.**8W=}M)=9


w22
3	2i1	2F+	2	2s-DD$cdddd}tj}|j||j|dd|j|dd|j|ddtj}|jt	|j|j|dd|j|dd|j|ddtj}|jd|jD|j|dd|j|dd|j|dd|j
tj5|jd	d
iddd|jd	||j
t|j|j
t|jdy#1swY]xYw)Nrerr)r>rrr>r-rc3*K|]\}}||f
ywNr~).0r%r&s   r'	<genexpr>z*MorselTests.test_update.<locals>.<genexpr>s9Aq!f9srr r)
rrrrrrrsrtr	TypeError)r!rrs   r'test_updatezMorselTests.test_updatesAG!

g	*A.	*A.)=9!

d7==?+,	*A.	*A.)=9!

999	*A.	*A.)=9


w22
3	0MM9g./	0F+)V]]3)V]]A6		0	0s>G..G7ctj}|jddd|jdddt	t
jdzD]}|j|5tjtj||}|j|tj|j|||jt|t|dddy#1swYxYw)NrYrZrrrrerf)
rrrrrirjrkrOrlrmrrry)r!rrgrs    r'rqzMorselTests.test_pickles>>#UE5)
	622Q67	?EE*
?!<<Xu(EF%%h?  84  XH
>	
?
?	?
?
?s
-BC88D	c	
tj}|jt|d|jt	|d|jddd|jt|d|jt	|d|j
dd	d
dddd
|jt|d|jt	|dd|d<d|d<|jt|d|jt	|dtj}|jdddd|d<|jt|d|jt	|dy)Nz<Morsel: None=None>zSet-Cookie: None=Nonerr9	coded_valz<Morsel: key=coded_val>zSet-Cookie: key=coded_valrrYrrre)r/rxrrArFr-zV<Morsel: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1>zXSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1TrFrGzh<Morsel: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1>zjSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1r>zA<Morsel: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+>zCSet-Cookie: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+)rrrr
ryrrassertRegexrs  r'	test_reprzMorselTests.test_reprsu!f'<=V&=>

5%-f'@AV&AB

#

		
f0	1	
V/	0 xzfB	C	
VA	B!

5%-yf=	>	
V<	=r)N)r{r|r}rrrrrrrrrrqrr~r)r'rrs?&+
@H>$21h-",,$76?&=r)rcV|jtjt|Sr)addTestdoctestDocTestSuiter)loadertestspatterns   r'
load_testsrs	MM'&&w/0Lr)__main__)runittestrhttprrjTestCaserrrr{mainr~r)r'<module>rs_
]
(##]
@v=(##v=r
zHMMOr)