+
    i&                        R t ^ RIHt ^ RIHt ^ RIt^ RIHtHt ^ RI	H
t
HtHtHtHtHtHt ^ RIHtHtHt  ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]4      t^ RIHtHt  ! R R]4      t ! R R]4      tR# )ztests for passlib.util)with_statement)partialN)is_ascii_safeto_bytes)irangePY2PY3uunicode
join_bytesPYPY)TestCasehbrun_with_fixed_seedsc                      a  ] tR t^t o RtR tR tR tR tR t	]
! RR7      R	 4       tR
 tR tR tR tR tR tR tR tRtV tR# )MiscTestz#tests various parts of utils modulec                    ^ RI Hp V P                  \        V4      R4       \	        V4       V P                  R\	        V4      9   4       V P                  R\	        V4      9   4       R# )ztest compat's lazymodule)compatz,^<module 'passlib.utils.compat' from '.*?'>$	UnicodeIOr   N)passlib.utilsr   assertRegexreprdir
assertTrue)selfr   s   & V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/passlib/tests/test_utils.pytest_compatMiscTest.test_compat   sP    (fH	J 	Fs6{23CK/0    c                   a ^ RI Ho  ! V3R lR\        4      pV P                  VP                  ^4       VP
                  R,          pV P                  VP                  VP                  4       R# )    )classpropertyc                   8   <a  ] tR t^'t o ^t ZR 4       tRtV tR# ))MiscTest.test_classproperty.<locals>.testc                    V P                   # N)xvar)clss   &r   xprop/MiscTest.test_classproperty.<locals>.test.xprop)   s    xxr    N)__name__
__module____qualname____firstlineno__r&   r(   __static_attributes____classdictcell__)__classdict__r!   s   @r   testr#   '   s     D   r   r2   r(   N)	passlib.utils.decorr!   objectassertEqualr(   __dict__assertIsim_func__func__)r   r2   propr!   s   &  @r   test_classpropertyMiscTest.test_classproperty$   sL    5	 6 	  	Q'}}W%dllDMM2r   c                *   ^ RI Hp V! RRR7      R 4       pV P                  RVP                  9   4       V P	                  \        \        RR7      4      ;_uu_ 4        V P                  V! ^^4      R
4       R	R	R	4       R	#   + '       g   i     R	# ; i)r    )deprecated_functionz1.6z1.8)
deprecatedremovedc                     V # )ztest docstringr*   )argss   *r   	test_func4MiscTest.test_deprecated_function.<locals>.test_func5   s	     Kr   z.. deprecated::zvthe function passlib.tests.test_utils.test_func() is deprecated as of Passlib 1.6, and will be removed in Passlib 1.8.)categorymessageN)      )r3   r>   r   __doc__assertWarningListdictDeprecationWarningr5   )r   r>   rC   s   &  r   test_deprecated_function!MiscTest.test_deprecated_function1   s    ; 
u	=	 
>	 	)Y->->>?##D2D2%  
 Yq^U3   s   BB	c                n  a ^ RI Ho  ! V3R lR\        4      pV! 4       pV P                  VP                  ^ 4       V P                  VP                  ^ 4       V P                  VP
                  ^4       VP                  p\        '       g)   V P                  VP                  VP                  4       R# R# )r    )memoized_propertyc                   8   <a  ] tR t^Ft o ^ t ZR 4       tRtV tR# ).MiscTest.test_memoized_property.<locals>.dummyc                :    V P                   pV^,           V n         V# )rG   counter)r   values   & r   rV   4MiscTest.test_memoized_property.<locals>.dummy.valueI   s    $Qwr   rT   N)r+   r,   r-   r.   rU   rV   r/   r0   )r1   rP   s   @r   dummyrR   F   s     G r   rX   N)
r3   rP   r4   r5   rV   rU   r   r7   r8   r9   )r   rX   dr:   rP   s   &   @r   test_memoized_propertyMiscTest.test_memoized_propertyC   s    9	F 	 G!$!$A&{{sMM$,,6 r   c                `   ^ RI Hp \        WP                  4       4      pV P	                  \        V! ^ 4      4      ^ 4       V! ^
4      pV! ^
4      pV P                  V\        4       V P	                  \        V4      ^
4       V P	                  \        V4      ^
4       V P                  W44       R# )zgetrandbytes())getrandbytesN)	r   r]   r   	getRandomr5   lenassertIsInstancebytesassertNotEqual)r   r]   wrapperabs   &    r   test_getrandbytesMiscTest.test_getrandbytesX   s    .,(89WQZ!,BKBKa'Q$Q$A!r   i   )countc           	     :   ^ RI Hp \        W P                  VR7      4      pV P	                  V! R^ 4      R4       V P                  \        VRR4       V P                  \        VR^ 4       V P	                  V! R^4      R4       V! \        R4      ^ 4      pV! \        R4      ^ 4      pV P                  V\        4       V P                  WE4       V P	                  \        \        V4      4      \        R4      \        R4      \        R4      .4       V! R	^ 4      pV! R	^ 4      pV P                  V\        4       V P                  WE4       V P	                  \        \        VP                  R
4      4      4      \        R4      \        R4      \        R4      .4       R# )zgetrandstr()
getrandstr)seedabc rd   aaaaare   c   abcasciiN)r   rk   r   r^   r5   assertRaises
ValueErrorr	   r`   r
   rb   sortedsetra   decode)r   rl   rk   rc   xys   &&    r   test_getrandstrMiscTest.test_getrandstrd   sR    	-*nn$n&?@ 	q)2. 	*gub9 	*gr15 	a'2 AeHb!AeHb!a)A A!C&3#)?@ FBFBa'A AHHW$5 67!C&3#9OPr   c                    ^ RI Hp \        P                  ! RR4       V P	                  \        V! ^4      4      ^4       R# )zgenerate_password())generate_passwordignorez1The function.*generate_password\(\) is deprecatedN)r   r~   warningsfilterwarningsr5   r_   )r   r~   s   & r   test_generate_passwordMiscTest.test_generate_password   s1    3*]^.r23R8r   c                    ^ RI Hp ^ RIHp V! R.4      pV P	                  V! V4      4       V P                  V! V4      '       * 4       R# )ztest is_crypt_context())is_crypt_context)CryptContext	des_cryptN)r   r   passlib.contextr   r   assertFalse)r   r   r   ccs   &   r   test_is_crypt_contextMiscTest.test_is_crypt_context   s=    20;-((,--b112r   c                
   ^ RI p^ RIHp VP                  V! 4       4      pVP	                  ^ R4      pVP                  V! 4       4      pVP	                  ^ R4      pV P                  WE4       VP                  V! V4      4       R# )ztest genseed()N)genseedl    d(	 )randomr   r   Randomrandintrb   rl   )r   r   r   rngrd   re   s   &     r   test_genseedMiscTest.test_genseed   sf    )mmGI&KK6"mmGI&KK6"A r   c                r  aa ^ RI HpHpHp ^ RIHpHp V! 4       pV'       gU   V P                  VR4       V P                  V! RR4      R4       V P                  V! RR4      4       V P                  R4      hV'       g   V P                  R4      hR F  pWv9   g   K   M	  VR,          pV! V4      o\        SR	R4      '       d   SP                  SP                  R
7      oT3R lp\        R4      p	V! V	4      p
V! W4      pV P                  V\         4       V P                  W4       V P                  V! \#        V	4      \#        V
4      4      V
4       V
RR R,           pV P                  V! W4      V
4       \        R4      pV! V4      pV P                  V! W4      V4       V P                  V! \#        V4      \#        V4      4      V4       V P%                  \&        VRV
4       V P)                  V! RV
4      4       V P                  V! RV4      4       ^ RI Hp VP,                  p RoV3R lVn        R F4  oV P                  V! RV
4      R4       V P                  V! RV
4      4       K6  	  RoV P                  V! RV
4      R4       V P                  V! RV
4      4       VVn        R#   TTn        i ; i)ztest crypt.crypt() wrappers)	has_crypt
safe_crypt
test_crypt)get_supported_os_crypt_schemesget_crypt_handlerr2   aaNzaaqPiZY5xR5l.zcrypt.crypt() not availablez0crypt() present, but no supported schemes found!
min_rounds)roundsc                    < \        V \        4      '       g   Q hSP                  V 4      p\        V\        4      '       d   VP	                  R 4      p\        V\        4      '       g   Q hV# )utf-8)
isinstancer
   hashra   rx   )secretr   hashers   & r   get_hash%MiscTest.test_crypt.<locals>.get_hash   sW    fg....;;v&D$&&{{7+dG,,,,Kr   xxu   testሴ c                    < S# r%   r*   )r   r   retvals   &&r   <lambda>%MiscTest.test_crypt.<locals>.<lambda>   s    fr   xxxr*   )	md5_cryptsha256_cryptrs   )Nrn   :z:0z*0)r   r   r   r   passlib.registryr   r   r5   r   skipTestfailgetattrusingr   r	   r`   r
   r   rt   ru   r   utils_crypt)r   r   r   r   r   r   	supportedschemer   s1h1resulth1xs2h2modorigr   r   s   &                @@r   r   MiscTest.test_crypt   sr   CCV 34	Y+Z5t<Z@A-- =>> 
 ))NOO 4F" 4 r]F"6*6<..\\):):\;F	 vYb\B#fg.$HRL(2,?D "gnB,b1 |_b\B+R0HRL(2,?D 	*j&"= 	
62./FC01
 	$zz	F4CJ5  FB!7>  FB!78 6 FZ3U;Z34 CJCJs   *A:J- -	J6c                (  aa ^ RI HoHo V P                  \        S\        R4      R4       V P                  \        S\        R4      ^4       V P                  \        S\        R4      R4       V P                  \        SR\        R4      4       V P                  \        SR^4       V P                  \        SRR4       V P                  \        SR\        R4      4       V P                  \        SRR4       V P                  \        S^\        R4      4       V P                  \        S^R4       VV3R lp\        R4      \        R4      \        R4      ^
,          3 F  pV! V4      '       d   V P                  S! W"4      R	V: R
24       MV P                  \        SW"4       V P                  S! W"4      R	V: R
24       VP                  R4      pV P                  S! W"4      R	V: R
24       K  	  \        R4      \        R4      3\        R4      \        R4      3\        R4      \        R4      3\        R4      \        R4      3\        R4      ^
,          RR \        R4      ,           \        R4      ^
,          3\        R4      \        R4      3\        R4      \        R4      3\        R4      \        R4      3\        R4      \        R4      33	 EF9  w  r4V! V4      '       dR   V! V4      '       dD   V P                  S! W44      RV: RV: R
24       V P                  S! WC4      RV: RV: R
24       M.V P                  \        SW44       V P                  \        SWC4       V P                  S! W44      RV: RV: R
24       V P                  S! WC4      RV: RV: R
24       VP                  R4      pVP                  R4      pV P                  S! W44      RV: RV: R
24       V P                  S! WC4      RV: RV: R
24       EK<  	  R# )ztest consteq())consteqstr_consteqrn   r   Nc                 N   < SSJ ;'       g    \         ;'       g    \        V 4      # r%   )r   r   )rV   r   r   s   &r   consteq_supports_string6MiscTest.test_consteq.<locals>.consteq_supports_string  s%     {*IIcII]55IJr   rd   rm   u   ÿ¢ zvalue r   latin-1rp   abcabczbaabcabzabcabcabzabcdefdefabcqwertyuiopasdfghjklzxcvbnmzvalues  rs   )	r   r   r   rt   	TypeErrorr	   r   encoder   )r   r   rV   lrr   r   s   &    @@r   test_consteqMiscTest.test_consteq   s>    	7 	)WaeS9)WaeQ7)WaeT:)Wc1R59)Wc15)Wc48)WdAbE:)WdC8)Wa27)Wa5	K #%$%b(E
 'u-- 5e7MN!!)WeCOOK5e7MNLL+EOOGE1%3IJ" 33(88-88-88-&'*CR01V9<()",. 2af%5ak*5ak*/0!E(;CA 'q)).Ea.H.H  1Q0GH  1Q0GH!!)Wa;!!)Wa;[.1Q0GH[.1Q0GH#A#AWQ]q,CDWQ]q,CD7r   c                
   V P                  4        ^ RIHp V P                  \        VR4       V P                  \        V^4       V P                  \        VR4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R	4      4       V P                  V! \        R
4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  V! \        R 4      4      \        R 4      4       V P                  V! \        R!4      4      \        R"4      4       V P                  V! \        R#4      4      \        R#4      4       V P                  V! \        R$4      4      \        R$4      4       V P                  V! \        R%4      4      \        R&4      4       V P                  V! \        R'4      4      \        R"4      4       V P                  \        V\        R(4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  V! \        R4      4      \        R4      4       R# ))z"test saslprep() unicode normalizer)saslprepNr   rn      ­u   $­$‍$z$$$u
   $ $ $　$z$ $ $ $u   à   àr   u   ᠎u   ￹u   u   ﷐u   u   �u   ⿰u   ‎u   ⁯u   ऀu   ￸u   󠀁u   ا1u   اu   ابu   ا1بu   اAبu   xاzxAzu   I­XIXuserUSER   ªrd   u   Ⅸ)require_stringprepr   r   rt   r   r5   r	   ru   )r   sps   & r   test_saslprepMiscTest.test_saslprepe  s   !0 	)R.)R+)R- 	AbEAbE*AhK!B%0 	A/011U8< 	A123Qy\B 	AiL)1X;7AhK!H+6 	*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!H+6*b!L/: 	*b!N*;<AhK!H+6An-..0ABA234a8L6MN*b!,@*AB*b!J-8AjM*AjM: 	AjM*AdG4AfI&	2AfI&	2AhK!C&1AhK!D'2*b!H+6*b!N*;< 	*b!N*;<A234a8L6MNr   c                >   ^ RI Hp V P                  V! R4      . 4       V P                  V! R4      . 4       V P                  V! R4      R.4       V P                  V! R4      R.4       V P                  V! R4      RR.4       V P                  V! R4      RR.4       R	# )
r    )
splitcommarn   ,rd   z a , z a , bre   z a, b, N)r   r   r5   )r   r   s   & r   test_splitcommaMiscTest.test_splitcomma  s    ,B,C"-C3%0G,se4H-Sz:I.c
;r   c           
        ^ RI Hp R F  pVP                  R4       \        V4      p\	        V^,           4       F  pRV: RV: R2pV! W$4      pVP                  R4       V P                  \        V4      W5R7       V P                  \        V4      \        WC4      VR7       V P                  \        V4      \        V^,           V^,           4      VR7       V P                  WbR\        V4       VR7       K  	  K  	  R FP  p\        V4      p\	        V^,           4       F,  pRV: RV: R2pV! W$4      pV P                  WbRV VR7       K.  	  KR  	  R FW  p\        V4      p\	        V^,           4       F3  pRV: RV: R2pV! W$4      pV P                  WbRV^,            VR7       K5  	  KY  	  R	pV P                  V! V^ 4      R4       V P                  V! V^4      R
4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^4      R4       V P                  V! V^	4      R	4       V P                  V! V^
4      R	4       V P                  V! V^4      R	4       R# )z
utf8_truncate()
)utf8_truncater   r   zsource=z index=z: )msgNs
   MNOP   Ms   MNs   MNs   MNs   MNO)	r      1s   123   s
      s
   s   a þþs&   abcdefghjusdfaoiu þþdsfioauweoiruer)   s
       s
             )   s
   )
r   r   rx   r_   rangeassertLessEqualassertGreaterEqualmin
assertLessr5   )r   r   sourceendidxprefixr   s   &      r   test_utf8_truncateMiscTest.test_utf8_truncate  s    	0
F MM'"f+CS2X393?&v3 g& $$S[#$B ''FS]'OFSq#'-BO   V)=6 J! '#
N
F f+CS2X393?&v3  6 B '
"
F f+CS2X393?&v3  QV D '
" 1vq137vq148vq159vq1.	0 	vq12	4 	vq12	4 	vq12	4 	vq12	4 	vq13	5 	vq18	: 	vr28	: 	vr28	:r   r*   N)r+   r,   r-   r.   rI   r   r;   rM   rZ   rf   r   r{   r   r   r   r   r   r   r   r   r/   r0   r1   s   @r   r   r      st     -
134$7*
" %&Q &&QP93TlEELMO^<t: t:r   r   c                   H   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )	CodecTesti7  z,tests bytes/unicode helpers in passlib.utilsc                   \         '       d&   ^ RIpV P                  \        VP                  4       M$^ RIpV P                  \        VP
                  4       V P                  R\        4       V P                  R\        4       \         '       d$   V P                  RP                  R4      R4       R# V P                  RR4       R# )z*test b() helper, bytes and native str typeNr       r       ÿ)	r   builtinsr7   ra   __builtin__strr`   r5   rx   )r   r  s   & r   
test_bytesCodecTest.test_bytes:  s    3MM%0*MM%.c5)k513[//	:JG[*5r   c                r   ^ RI Hp V P                  V! \        R4      4      R4       V P                  V! \        R4      4      R4       V P                  V! \        R4      R4      R4       V P	                  \
        V\        R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! RR4      R4       V P                  V! RRR	R
4      R4       V P	                  \        VRR4       V P	                  \        VR4       R# )ztest to_bytes())r   rm   rq   r      ÿr   r  rr   rn   r   N)r   r   r5   r	   rt   ru   AssertionErrorr   )r   r   s   & r   test_to_bytesCodecTest.test_to_bytesJ  s   * 	!E(+fE!J-0oN 	!J-;kJ*h*wG 	&)&A+.+F/2/J 	/9=<K	M 	/9b'J<G	I 	.(E4@)Xt4r   c                d   ^ RI Hp V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      4      \        R4      4       V P                  V! \        R4      R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! RR4      \        R4      4       V P	                  \
        VR4       V P	                  \        VRR	4       V P	                  \        VR	4       R	# )
ztest to_unicode())
to_unicoderm   r  rr   rq   r  r  r   N)r   r  r5   r	   rt   ru   r  r   )r   r  s   & r   test_to_unicodeCodecTest.test_to_unicodeg  s    , 	AeH-ahGAjM2a
mL 	AjM7;a
mL 	F+!E(CO4!J-HK;<=jM	K*j+> 	.*eTB)Z6r   c                   ^ RI Hp V P                  V! \        R4      R4      R4       V P                  V! RR4      R4       \        '       d<   V P                  V! \        R4      R4      R4       V P                  \        VRR4       M:V P                  \        V\        R4      R4       V P                  V! RR4      R4       V P                  V! \        R4      R4      R4       V P                  V! R	R4      R4       T P                  V! \        R4      R
4      \        '       d   RMR4       T P                  V! RR
4      \        '       d   RMR4       V P                  \        VRR4       R# )ztest to_native_str())to_native_strrm   rr   rq   r   s   àu   Ã r      r   N)	r   r  r5   r	   r   rt   UnicodeDecodeErrorUnicodeEncodeErrorr   )r   r  s   & r   test_to_native_strCodecTest.test_to_native_str}  s8   / 	qx95Avw7? 3]1V9g>G0-%' 0-6%'];@*M 	qy)<fEw	:FC 	qy':#&3J	8{G<#&3J	8 	)]D'Br   c                    ^ RI Hp V P                  V! R4      4       V P                  V! \        R4      4      4       V P	                  V! R4      4       V P	                  V! \        R4      4      4       R# )ztest is_ascii_safe())r   s    abcz abcs    abcu    abcN)r   r   r   r	   r   )r   r   s   & r   test_is_ascii_safeCodecTest.test_is_ascii_safe  sW    /n56a&678~67q'789r   c                   ^ RI Hp V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       V P                  V! RR4      4       R# )ztest is_same_codec())is_same_codecNrr   ASCIIr   utf8UTF_8)r   r!  r   r   )r   r!  s   & r   test_is_same_codecCodecTest.test_is_same_codec  s    /dD12tW56gw78gw78gw78gv67gw78w89r   r*   N)r+   r,   r-   r.   rI   r  r  r  r  r  r%  r/   r0   r  s   @r   r  r  7  s,     66 5:7,C>:: :r   r  c                   B   a  ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
Base64EngineTesti  z%test standalone parts of Base64Enginec                    ^ RI HpHp V P                  \        V^4       V P                  \
        WRR 4       V P                  \
        WRR R,           4       R# )r    )Base64Engine
AB64_CHARSNArs   )passlib.utils.binaryr*  r+  rt   r   ru   )r   r*  r+  s   &  r   test_constructor!Base64EngineTest.test_constructor  sN    A 	)\15 	*lsOD 	*lsOc4IJr   c                >   ^ RI Hp V P                  V! R4      \        R4      4       V P                  V! \	        R4      4      \        R4      4       V P                  \        V\	        R4      4       V P                  \        VR4       V P                  \        VR4       V P                  \        V\	        R4      4       V P                  V! R	4      \        R
4      4       V P                  \        VR4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       R# )zab64_decode())ab64_decoderq   69b7rm      abÿ   ab   ab!ab!   abcd69b71d   abcde   abcdef69b71d79   abcdeQ   abcdefg
69b71d79f8   ab+/69bfbf   ab./N)r-  r1  r5   r   r	   rt   ru   r   )r   r1  s   & r   test_ab64_decode!Base64EngineTest.test_ab64_decode  s>   4 	V,bj9QuX.6
; 	*k1X;? 	)[)<)[&9)[!E(; 	W-r(|<*k8<Y/J@Y/J@Z0"\2BC 	W-r(|<W-r(|<r   c                   ^ RI Hp V P                  V! \        R4      4      R4       T P	                  \
        '       d   \        M\        V\        R4      P                  R4      4       V P                  V! \        R4      4      R4       V P                  V! \        R4      4      R4       V P                  V! \        R	4      4      R
4       V P                  V! \        R4      4      R4       R# )zab64_encode())ab64_encoder2  rq   r   r8  r7  r;  r<  r>  r=  r@  rA  N)	r-  rE  r5   r   rt   r   r   r  rx   )r   rE  s   & r   test_ab64_encode!Base64EngineTest.test_ab64_encode      4 	RZ0&9 	ss)0B%r&z'8'8'C	E 	R\2G<R
^4i@R%56
C 	R\2G<r   c                   ^ RI Hp V P                  V! R4      \        R4      4       V P                  V! \	        R4      4      \        R4      4       V P                  \        V\	        R4      4       V P                  \        VR4       V P                  \        VR4       V P                  \        V\	        R4      4       V P                  V! R	4      \        R
4      4       V P                  \        VR4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       V P                  V! R4      \        R4      4       R# )zb64s_decode())b64s_decoderq   r2  rm   r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  N)r-  rJ  r5   r   r	   rt   ru   r   )r   rJ  s   & r   test_b64s_decode!Base64EngineTest.test_b64s_decode  s
   4 	V,bj9QuX.6
; 	*k1X;? 	)[)<)[&9)[!E(; 	W-r(|<*k8<Y/J@Y/J@Z0"\2BCr   c                   ^ RI Hp V P                  V! \        R4      4      R4       T P	                  \
        '       d   \        M\        V\        R4      P                  R4      4       V P                  V! \        R4      4      R4       V P                  V! \        R4      4      R4       V P                  V! \        R	4      4      R
4       V P                  V! \        R4      4      R4       R# )zb64s_encode())b64s_encoder2  rq   r   r8  r7  r;  r<  r>  r=  r@  r?  N)	r-  rN  r5   r   rt   r   r   r  rx   )r   rN  s   & r   test_b64s_encode!Base64EngineTest.test_b64s_encode  rH  r   r*   N)r+   r,   r-   r.   rI   r.  rB  rF  rK  rO  r/   r0   r  s   @r   r(  r(    s(     /
K=8=&D.= =r   r(  c                      a  ] tR tRt o RtRtRtRtRtR t	R t
R tR tR	 tR
 tR tR tRR. RO3RR. RO3.tRR. RO3.tR tR tR tR tR tR tR tR tR tRtV tR# )_Base64Testi   z+common tests for all Base64Engine instancesN   ?c                .   a  \        V 3R lV 4       4      # )z!generate byte string from offsetsc              3   b   <"   T F$  pSP                   P                  W^,            x  K&  	  R# 5i)rG   N)enginebytemap).0or   s   & r   	<genexpr> _Base64Test.m.<locals>.<genexpr>5  s$     Fg$++--a!4gs   ,/)r   )r   offsetss   f*r   m_Base64Test.m3  s    FgFFFr   c                    V P                   pVP                  pV P                   F$  w  r4V! V4      pV P                  WTRV: R24       K&  	  R# )z,test encode_bytes() against reference inputszencode r   N)rV  encode_bytesencoded_datar5   )r   rV  r   rawencodedr   s   &     r   test_encode_bytes_Base64Test.test_encode_bytes:  sF    $$ --LCC[FVWc.CD .r   c                    V P                   pVP                  pV P                  \        V\	        R4      4       V P                  \        VR4       R# )z"test encode_bytes() with bad inputr   N)rV  r`  rt   r   r	   )r   rV  r   s   &  r   test_encode_bytes_bad!_Base64Test.test_encode_bytes_badB  s>    $$)VQvY7)VT2r   c                    V P                   pVP                  pV P                   F$  w  r4V! V4      pV P                  WSRV: R24       K&  	  R# )z,test decode_bytes() against reference inputszdecode r   N)rV  decode_bytesra  r5   )r   rV  rx   rb  rc  r   s   &     r   test_decode_bytes_Base64Test.test_decode_bytesL  sF    $$ --LCG_FVS'*CD .r   c                ^   \         '       d   R M\        pV P                  pV P                  pVP                  pRpV P                  V! V! ^ ^ 4      4      V4       \        ^ ^4       F  pVP                  '       d!   V^8  d   TMV! ^V^,
          ,          4      pMV^8  d   V! ^V^,           ,          4      MTpV P                  V! V! ^ ^V,          4      4      VRV,          4       K  	  V P                  V! V! ^ ^ ^ 4      4      V^,          4       \        ^ ^4       F  pVP                  '       d!   V^8  d   TMV! ^V^,
          ,          4      pMV^8  d   V! ^V^,           ,          4      MTpV P                  V! V! ^ ^ ^V,          4      4      WW,           RV,          4       K  	  R# )z(test decode_bytes() ignores padding bitsc                     \        V .4      # r%   )ra   )vs   &r   r   7_Base64Test.test_decode_bytes_padding.<locals>.<lambda>V  s
    %*r   r   z
%d/4 bits:z
%d/2 bits:N)r   chrrV  r]  rj  r5   r   big)r   bchrrV  r]  rx   BNULLicorrects   &       r   test_decode_bytes_padding%_Base64Test.test_decode_bytes_paddingT  sX   ),$#FF$$ 	!A/qAzzz#$q5%d1qs8n,-E$q1Q3x.uVAa1I.9IJ  	!Aa)573qAzzz#$q5%d1qs8n,-E$q1Q3x.uVAa!Q$K0%/)A-/ r   c                   V P                   pVP                  pV P                  \        W!P                  R,          4       V P                  V P                  VP                  9  4       V P                  \        W P                  ^,          4       V P                  \        W!P                  R,          4       V P                  \        VR4       R# )z"test decode_bytes() with bad input:N   N:N   NN)	rV  rj  rt   ru   rW  r   bad_byter   charmap)r   rV  rx   s   &  r   test_decode_bytes_bad!_Base64Test.test_decode_bytes_bado  s    $$ 	*fnnR.@A 	V^^;<*fmmAo> 	)V^^B-?@)VT2r   c                4   V P                   p^ RIHpHp V P	                  4       pRp\        R4       EFa  pTP                  V'       d   ^M^ ^4      pV'       g   Rp^V,          ^,           ^,          pV! WG4      p	VP                  V	4      p
V P                  \        V
4      V4       VP                  V
4      pV P                  W4       V^,          ^8X  d   WtP                  . RO4      ,          p^V,          ^,          pV! WAP                  V4      p
VP                  V
4      p	V P                  \        V	4      VRV,          4       VP                  V	4      pV^,          '       d   V P                  VRR V
RR 4       EKP  V P                  W4       EKd  	  R# )	z2test encode_bytes/decode_bytes against random data)r]   rk   Fi  Tzencoded %d:Nrs   )rs   rG   rH   )rV  r   r]   rk   r^   r   r   r`  r5   r_   rj  choicerW  )r   rV  r]   rk   r   saw_zeroru  sizeenc_sizerb  rc  r   raw_sizes   &            r   
test_codec_Base64Test.test_codec  sZ   :nnA ;;Hq!R8D$q1}Hs)C ))#.GS\84 ((1FV) ax1}

8,,vqyH nnd;G %%g.CSXx1EF ((-Faxx  gcrl;  1O r   c                   ^ RI Hp V P                  4       pV P                  pV P                  P                  p^ pVR8  Ed6   VP                  ^ ^4      pV! W#P                  V4      P                  R4      pV^,          ^8X  d   V P                  \        WG4       Kb  VP                  VP                  V4      4      pVP                  4       R8  d#   VP                  R4      pVP                  R4      pWx8X  d.   V! V4      w  rV P                  V	4       V P                  W4       MEV P!                  V^,          ^ 4       V! V4      w  rV P#                  V	4       V P                  W4       V^,          pEK=  R# )ztest repair_unused()rj   i,  rr   g      ?N)r   rk   r^   rV  check_repair_unusedr   r}  r   rt   ru   r`  rj  r   rx   r   r5   rb   r   )r   rk   r   rV  r  ru  r  cdatardataokr   s   &          r   test_repair_unused_Base64Test.test_repair_unused  s>    	-nn"kk==#g;;q$DsNND9@@IEax1}!!*.AI''(;(;E(BCEzz|b W-W-~07
  $  / ##D1Ha007
#  /FA- r   s   3"s   "3s   "3s   "c                (   V P                   pV P                  V P                  ,            F9  w  r#pVP                  W44      pVP	                  V4      pV P                  Wb4       K;  	  V P                  \        VP                  \        R4      . 4       R# )ztest encode_transposed_bytes()rd   N)	rV  
transposedtransposed_dupsencode_transposed_bytesrj  r5   rt   r   r	   )r   rV  r   inputr\  tmpouts   &      r   test_encode_transposed_bytes(_Base64Test.test_encode_transposed_bytes  s{    &*oo8L8L&L&L"F700@C%%c*CS) 'M
 	)V%C%CQsVRPr   c                    V P                   pV P                   F9  w  r#pVP                  V4      pVP                  WT4      pV P	                  Wc4       K;  	  R# )ztest decode_transposed_bytes()N)rV  r  r`  decode_transposed_bytesr5   )r   rV  r  r   r\  r  r  s   &      r   test_decode_transposed_bytes(_Base64Test.test_decode_transposed_bytes  sL    &*oo"E7%%e,C00>CS) '6r   c                    V P                   pV P                   F9  w  r#pVP                  V4      pV P                  \        VP
                  VV4       K;  	  R# )z8test decode_transposed_bytes() fails if map is a one-wayN)rV  r  r`  rt   r   r  )r   rV  r  _r\  r  s   &     r    test_decode_transposed_bytes_bad,_Base64Test.test_decode_transposed_bytes_bad  sM    !%!5!5Eg%%e,Ci)G)G%' "6r   c                b   V P                  4       pV P                  p\        VRV,          4      p\        VRV,          4      pV) ^,          pW,           ^,          p^V,          p	V F4  w  rV! V
4      pV P                  V\        4       V P                  W4       K6  	  V P                  \        VR4       V P                  \        WY4       V F#  w  rV P                  V! V4      V
RV: R24       K%  	  V P                  pV P                  \        Wm! ^ 4      V^,           ,          4       V P                  \        Wm! ^ 4      V^,
          ,          4       V P                  \        W`P                  V,          4       V P                  \        WdP                  ^ ,          4       V P                  \        VR4       ^ RIHp \        ^d4       F  pVP                  ^ V	^,
          4      p
V! V
4      pV P                  \!        V4      V4       V P                  V! V4      V
4       V! W4P"                  V4      pV! V4      p
V P%                  V
^ RV,          4       V P'                  WRV,          4       V! V
4      pV'       d   V P                  VRR	 VRR	 4       K  V P                  W4       K  	  R# )
z5helper to check encode_intXX & decode_intXX functionszencode_int%szdecode_int%szencoded r   Nrj   zdecode %r out of bounds:rs   r   )r^   rV  r   r`   ra   r5   rt   ru   r]  r|  r   r}  r   rk   r   r   r_   rW  r   r   )r   bitsencoded_pairsr   rV  r   rx   padcharsupperrV   rc  r   r]  rk   ru  s   &&&             r   check_int_pair_Base64Test.check_int_pair  s6   nn$!67$!67eaiA4 ,NEE]F!!&%0V- , 	*fb1*f4 ,NEVG_eg5OP ,FF*fadE!Gn=*fadE!Gn=*fmmE.AB)V^^A->?)VT2 	-AKK57+EUmGS\51VG_e4 !nne<G7OE##E1.H7.RSOOE*Dw*NOE]F  gcrl;  1! r   c                ~    V P                   pV P                  pV P                  ^^ V! ^ 4      3^?V! ^?4      3.4       R# )   N)rV  r]  r  r   rV  r]  s   &  r   	test_int6_Base64Test.test_int6/  s9    FFAAaD	B";78r   c           
         V P                   pV P                  pT P                  ^^ V! ^ ^ 4      3^?VP                  '       d
   V! ^ ^?4      MV! ^?^ 4      3RV! ^?^?4      3.4       R# )   i  NrV  r]  r  rr  r  s   &  r   
test_int12_Base64Test.test_int124  sb    FFBAaFFJJJ1RAbG4ua2h6G I 	Jr   c                    V P                   pV P                  pT P                  ^^ V! ^ ^ ^ ^ 4      3^?VP                  '       d   V! ^ ^ ^ ^?4      M
V! ^?^ ^ ^ 4      3RV! ^?^?^?^?4      3.4       R# )   i Nr  r  s   &  r   
test_int24_Base64Test.test_int24:  sq    FFBAa!AJ


1Qq"Qq<qBr"~& ( 	)r   c                \   V P                   pV P                  pT P                  ^@^ V! ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 4      3^?VP                  '       d   V! ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^<4      MV! ^?^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 4      3RVP                  '       d   V! ^?^?^?^?^?^?^?^?^?^?^<4      MV! ^?^?^?^?^?^?^?^?^?^?^4      3.4       R# )@   Nl    r  r  s   &  r   
test_int64_Base64Test.test_int64A  s     FFB!Qq1Q!Aa1Q%?!@FJJJQq1Q!Aa1R0r!Aa1Qq!Aa02VZZZAbBr2bB2bA2bB2bR2>@!A 	Br   c                <   V P                   '       g   V P                  R4      hV P                  pV P                    F\  w  r#p\        VRV,          4      p\        VRV,          4      pV P	                  V! V4      V4       V P	                  V! V4      V4       K^  	  R# )z(test against reference integer encodingsznone defined for classzencode_int%dzdecode_int%dN)encoded_ints	skipTestsrV  r   r5   )r   rV  datarV   r  r   rx   s   &      r   test_encoded_ints_Base64Test.test_encoded_intsL  s       ..!9::!%!2!2DV^d%:;FV^d%:;FVE]D1VD\51	 "3r   r*   )rH   rG   r    )rG   rH   r    )r    r    rG   )r+   r,   r-   r.   rI   rV  ra  r  r|  r]  rd  rg  rk  rw  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r/   r0   r  s   @r   rR  rR     s     5 F L L HGE3E/63&-2^P 
/'2	/'2J 
/'2O
Q*'.2`9
J)	B	2 	2r   rR  )h64h64bigc                   2    ] tR tRtRt]tRt. ROtRR.t	Rt
R# )	H64_Testi_  ztest H64 codec functionsz	h64 codecr*   N)	r   r   )   Us   J/)   Us   Jd8)   UUs   JdOJ)   UUs   JdOJe0)   UUUs   JdOJeK3)   UUUs   JdOJeKZe)   UUs   JdOJj0)   UU_s   JdOJey3)   z.?   r  )   .z  r  )r+   r,   r-   r.   rI   r  rV  descriptionPrefixra  r  r/   r*   r   r   r  r  _  s&    "F#L  	Lr   r  c                   2    ] tR tRtRt]tRt. ROtRR.t	Rt
R# )	H64Big_Testix  ztest H64Big codec functionszh64big codecr*   N)	r  )r  s   JE)r  s   JOc)r  s   JOdJ)r  s   JOdJeU)r  s   JOdJeZI)r  s   JOdJeZKe)r  s   JOdJfk)r  s   JOdJeZw)r  r  r  )r  r  r  )r+   r,   r-   r.   rI   r  rV  r  ra  r  r/   r*   r   r   r  r  x  s&    %F&L  	Lr   r  )rI   
__future__r   	functoolsr   r   r   r   r   passlib.utils.compatr   r   r   r	   r
   r   r   passlib.tests.utilsr   r   r   r   r  r(  rR  r-  r  r  r  r  r*   r   r   <module>r     s     &   2 O O O B B
^:x ^:H{: {:@g=x g=Ru2( u2z	 -{ 2+ r   