
    <em                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 d dl	mZ  e
j        d          Zd dlZd dlmZ d dlmZ 	 d dlmZmZ n# e$ r ej        xZZY nw xY w e eeej                            d	                              Z G d
 de j                  Z G d de j                  Z G d de j                  Zd Z e!dk    r e j"                     dS dS )    N)support)import_helper)	os_helper_tkinter)Tcl)TclError)INT_MAXPY_SSIZE_T_MAX.c                       e Zd Zd ZdS )TkinterTestc                 8   |                      t          t          j        d           |                      t          t          j        i            |                      t          t          j        d           |                      t          t          j        dh           d S )NTstringset)assertRaises	TypeErrorr   _flattenselfs    $/usr/lib/python3.11/test/test_tcl.pytestFlattenLenzTkinterTest.testFlattenLen   sx    )X%6===)X%6;;; 	)X%6AAA)X%6@@@@@    N)__name__
__module____qualname__r    r   r   r   r      s(        A A A A Ar   r   c                   X   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ej        e j!        dk    d          d             Z"d Z#d  Z$d! Z%d" Z&d# Z'd$ Z(d% Z)d& Z*d' Z+d( Z,d) Z-e.j/        d*             Z0d+S ),TclTestc                 r    t                      | _        | j        j                                        | _        d S N)r   interptkwantobjectsr   s    r   setUpzTclTest.setUp*   s+    ee;>5577r   c                     | j         }|                    d           |                     |                    d          d           d S )Nset a 1set a1)r!   evalassertEqualr   tcls     r   testEvalzTclTest.testEval.   sC    k'**3/////r   c                 f    | j         }|                     |                    d          d           d S )Nzset a "a\0b"a b)r!   r*   r)   r+   s     r   test_eval_null_in_resultz TclTest.test_eval_null_in_result3   s1    k/22H=====r   c                 f    | j         }|                     |                    d          d           d S )Nzset a "<\ud83d\udcbb>"   <💻>)r!   assertInr)   r+   s     r   test_eval_surrogates_in_resultz&TclTest.test_eval_surrogates_in_result7   s0    kchh899>JJJJJr   c                 V    | j         }|                     t          |j        d           d S )Nr'   r!   r   r   r)   r+   s     r   testEvalExceptionzTclTest.testEvalException;   s)    k(38G44444r   c                 V    | j         }|                     t          |j        d           d S )Nzthis is wrongr6   r+   s     r   testEvalException2zTclTest.testEvalException2?   s)    k(38O<<<<<r   c                     | j         }|                    ddd           |                     |                    dd          d           d S )Nr   ar(   )r!   callr*   r+   s     r   testCallzTclTest.testCallC   sI    ks3%,,S11111r   c                 X    | j         }|                     t          |j        dd           d S )Nr   r;   r!   r   r   r<   r+   s     r   testCallExceptionzTclTest.testCallExceptionH   s+    k(38E#66666r   c                 Z    | j         }|                     t          |j        ddd           d S )Nthisiswrongr?   r+   s     r   testCallException2zTclTest.testCallException2L   s-    k(38F4@@@@@r   c                     | j         }|                    dd           |                     |                    d          d           d S )Nr;   r(   r'   r!   setvarr*   r)   r+   s     r   
testSetVarzTclTest.testSetVarP   sE    k

3s'**3/////r   c                     | j         }|                    dd           |                     |                    d          d           d S )Na(1)r(   zset a(1)rG   r+   s     r   testSetVarArrayzTclTest.testSetVarArrayU   sE    k

6#*--c22222r   c                     | j         }|                    d           |                     |                    d          d           d S )Nr&   r;   r(   r!   r)   r*   getvarr+   s     r   
testGetVarzTclTest.testGetVarZ   sA    kC-----r   c                     | j         }|                    d           |                     |                    d          d           d S )Nz
set a(1) 1rK   r(   rN   r+   s     r   testGetVarArrayzTclTest.testGetVarArray_   sC    kF++C00000r   c                 V    | j         }|                     t          |j        d           d S Nr;   r!   r   r   rO   r+   s     r   testGetVarExceptionzTclTest.testGetVarExceptiond   s)    k(3:c22222r   c                 V    | j         }|                     t          |j        d           d S )NrK   rU   r+   s     r   testGetVarArrayExceptionz TclTest.testGetVarArrayExceptionh   s)    k(3:f55555r   c                    | j         }|                    dd           |                     |                    d          d           |                    d           |                     |                    d          d           d S )Nr;      zinfo exists ar(   0r!   rH   r*   r)   unsetvarr+   s     r   testUnsetVarzTclTest.testUnsetVarl   sy    k

3q/223777S/22377777r   c                    | j         }|                    dd           |                    dd           |                     |                    d          d           |                     |                    d          d           |                    d           |                     |                    d          d           |                     |                    d          d           d S )	NrK   rZ   za(2)   zinfo exists a(1)r(   zinfo exists a(2)r[   r\   r+   s     r   testUnsetVarArrayzTclTest.testUnsetVarArrays   s    k

6!

6!"455c:::"455c:::V"455c:::"455c:::::r   c                 V    | j         }|                     t          |j        d           d S rT   )r!   r   r   r]   r+   s     r   testUnsetVarExceptionzTclTest.testUnsetVarException}   s)    k(3<44444r   c                 .    ddddddddd	d
dddz  ddz   fS )Nr   rZ   ii   l        l    l    l         l            l        r`   i  r   r   s    r   get_integerszTclTest.get_integers   s4    1b4!T'# 	#r   c           	      b   | j         j        }|                                 D ]}|                     |                    d|z            |           |                     |                    d|z            |           |                     |                    d|z                      dd                    t          dk     r|nt          d|z                       |                     |                    d|z            |           |                     |                    d          d           |                     t          |j                   |                     t          |j        d	d
           |                     t          |j        d           |                     t          |j        d           |                     t          |j        d           |                     t          t          t          f|j        d           |                     t          t          t          f|j        d           d S )Nz %d z %#o o )	   r   z%oz %#x *   4210s   42      E@r;   z42 u   42)r!   r"   rf   r*   getintreplacetcl_versionintr   r   r   
ValueErrorUnicodeEncodeError)r   r,   is      r   test_getintzTclTest.test_getint   s   kn""$$ 	9 	9ASZZ
33Q777SZZ!44a888 SZZ1(=(=c2(F(FGG"-"6"6QQCqMMK K KSZZ!44a8888B,,,)SZ000)SZt<<<)SZ777)SZ666(CJ4449j(;*f	. 	. 	.-z8D*j	2 	2 	2 	2 	2r   c                 &   | j         j        }|                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     t
          |j                   |                     t
          |j        dd           |                     t
          |j        d           |                     t          |j        d	           |                     t
          t          t          f|j        d
           |                     t          t          t          f|j        d           d S )Nz 42 rn   z 42.5 g     @E@rk   z42.5rm   s   42.5r;   z42.5 u   42.5)	r!   r"   r*   	getdoubler   r   r   rs   rt   r+   s     r   test_getdoublezTclTest.test_getdouble   sV   knv..555x00$777t,,d333r**D111)S]333)S]FDAAA)S]G<<<(CM37779j(;-	3 	3 	3-z8D-	7 	7 	7 	7 	7r   c                 h   | j         j        }|                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     t
          |j                   |                     t
          |j        dd           |                     t
          |j        d           |                     t
          |j        d           |                     t          |j        d	           |                     t
          t          t          f|j        d
           |                     t          t          t          f|j        d           d S )NonTr(   rk   r   Fs   on      ?r;   zon u   on)	r!   r"   assertIs
getbooleanr   r   r   rs   rt   r+   s     r   test_getbooleanzTclTest.test_getboolean   sh   kncnnT**D111cnnS))4000cnnR(($///cnnQ''///)S^444)S^T3???)S^U;;;)S^S999(CNC8889j(;.&	2 	2 	2-z8D.*	6 	6 	6 	6 	6r   c                    | j         }t          j        }|                     t          j        |           t          |d          5 }|                    d           d d d            n# 1 swxY w Y   |                    |           |                     |	                    d          d           |                     |	                    d          d           |                     |	                    d          d           d S )	NwzKset a 1
            set b 2
            set c [ expr $a + $b ]
            r'   r(   set b2zset c3
r!   r   TESTFN_ASCII
addCleanupunlinkopenwriteevalfiler*   r)   r   r,   filenamefs       r   testEvalFilezTclTest.testEvalFile   s%   k)	((333(C   	AGG    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	X'**3///'**3///'**3/////   A&&A*-A*c                    | j         }t          j        }|                     t          j        |           t          |d          5 }|                    d           d d d            n# 1 swxY w Y   |                    |           |                     |	                    d          d           |                     |	                    d          d           d S )Nr   z>
            set a "a b"
            set b "a\0b"
            r'   r/   r   r   r   s       r   test_evalfile_null_in_resultz$TclTest.test_evalfile_null_in_result   s   k)	((333(C   	AGG    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	X'**H555'**H55555r   c                 H   | j         }|                    dd          }|                     |j        dd|           |                    ddd           t          j        }|                     t          j        |           t          |d          5 }|                    d           d d d            n# 1 swxY w Y   |                    |           | 	                    |
                    d          d           | 	                    |
                    d          d           d S )	Nencodingsystemzutf-8wbsM   
            set a "<>"
            set b "<\ud83d\udcbb>"
            r'   r2   r   )r!   r<   r   r   r   r   r   r   r   r*   r)   )r   r,   r   r   r   s        r   "test_evalfile_surrogates_in_resultz*TclTest.test_evalfile_surrogates_in_result   sF   k88J11*hAAAXw///)	((333(D!! 	QGG    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	X'**N;;;'**N;;;;;s   B00B47B4c                     | j         }d}	 t          j        |           n# t          $ r
}Y d }~nd }~ww xY w|                     t
          |j        |           d S )Ndoesnotexists)r!   osremove	Exceptionr   r   r   )r   r,   r   es       r   testEvalFileExceptionzTclTest.testEvalFileException   sp    k"	Ih 	 	 	DDDD	(3<99999s     
44c                 V    | j         }|                     t          |j        d           d S )Nzpackage require DNEr6   r+   s     r   testPackageRequireExceptionz#TclTest.testPackageRequireException   s*    k(38,ABBBBBr   win32zRequires Windowsc                 *   t           j                            t          j                  }|d         dk    rt          j        d          dt           j        d         d|d         d|d	d          }t           j                            |          st          j        d
          t          j
                    5 }|                    d           t          j        |ddg          }d d d            n# 1 swxY w Y   |                     d|           d S )NrZ   :z$Absolute path should have drive partz\\COMPUTERNAME\r   z$\   zCannot connect to UNC PathTCL_LIBRARY-czimport tkinter; print(tkinter)s   tkinter)r   pathabspathsys
executableunittestSkipTestenvironexistsr   EnvironmentVarGuardunset
subprocesscheck_outputr3   )r   fullnameunc_nameenvstdouts        r   testLoadWithUNCzTclTest.testLoadWithUNC   sW    7??3>22A;##$JKKK %'Z%?%?%?$,QKKK$,QRRLL2 w~~h'' 	B#$@AAA*,, 	HIIm$$$,t%EFH HF	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H
 	j&)))))s   9-C22C69C6c                      j                             ddd                               ddd            fd}                     t          j                                        t          j        dd                                t          j        d	                                t
          j        d
            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |d d            |d!d"            |d#d"            |d$d%            |d&d'            |d(d'            |d)d*            |d+t          d,                     d S )-Nr   r;   r   b   c                                          |           }                    ||                               |t                     d S r    )
exprstringr*   assertIsInstancestrexprexpectedresultr   r,   s      r   checkz&TclTest.test_exprstring.<locals>.check  sF    ^^D))FVX...!!&#.....r   8.2+6   8.2 + 6spamri   r[   8.2 + 6z14.23.1 + $az6.12 + "$a.$b"z5.64*[llength "6 2"]8{word one} < "word $a"4*2 < 7hypot($a, 4)z5.05 / 4r(   5 / 4.0z1.25$5 / ( [string length "abcd"] + 0.0 )20.0/5.0z4.0"0x03" > "2"   [string length "a½€"]r   [string length "a\xbd\u20ac"]"abc"abcu   "a½€"u   a½€z"a\xbd\u20ac"z"a\0b"r/   2**64            )r!   r<   r   r   r   r   r   r   r   r,   s   ` @r   test_exprstringzTclTest.test_exprstring
  s6   kQQ	/ 	/ 	/ 	/ 	/ 	/
 	)S^444)S^UDAAA)S^Z@@@(CNF;;;b#i   j%   mU###!3'''&,,,ine$$$gsi   4f===j%   nc"""-s333.444guo}---...i"""gs5zz"""""r   c                 d     j                             ddd                               ddd            fd}                     t          j                                        t          j        dd                                t          j        d	                                t
          j        d
            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |d d            |d!d"            |d#d"                                t
          j        d$            |d%t          d&                     d S )'Nr   r;   r   r   r   c                                          |           }                    ||                               |t                     d S r    )
exprdoubler*   r   floatr   s      r   r   z&TclTest.test_exprdouble.<locals>.check0  sF    ^^D))FVX...!!&%00000r   r   r   r   r   ri           r   gffffff,@r   gffffff@r   gffffff@r   g       @r   r   r   g      @r   r|   r   g      ?r   r   g      @r   r   g      @r   r   r   r   )r!   r<   r   r   r   r   r   r   s   ` @r   test_exprdoublezTclTest.test_exprdouble,  s   kQQ	1 	1 	1 	1 	1 	1
 	)S^444)S^UDAAA)S^Z@@@(CNF;;;b#ij#mS!!!!3'''&,,,inc"""gsi4d;;;j#nc"""-s333.444(CNG<<<guU||$$$$$r   c                 t     j                             ddd                               ddd            fd}                     t          j                                        t          j        dd                                t          j        d	                                t
          j        d
            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd                                t
          j        d                                 t
          j        d!           d S )"Nr   r;   r   r   r   c                                          |           }                    ||                               |t                     d S r    )exprlongr*   r   rr   r   s      r   r   z$TclTest.test_exprlong.<locals>.checkO  sF    \\$''FVX...!!&#.....r   r   r   r   r   ri   r   r      r   r      r      r   r   r   r   rZ   r   r   r      r   r   r   r   r   )r!   r<   r   r   r   r   r   s   ` @r   test_exprlongzTclTest.test_exprlongK  s	   kQQ	/ 	/ 	/ 	/ 	/ 	/
 	)S\222)S\5$???)S\:>>>(CL&999b!ij!mQ!1%%%&***ina   gqi4a888j!na   -q111.222(CL':::(CL':::::r   c                      j                             ddd                               ddd            fd}                     t          j                                        t          j        dd                                t          j        d	                                t
          j        d
            |dd           dD ],} ||d            |d|z  d            |d|z  d           -dD ],} ||d            |d|z  d            |d|z  d           - |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd            |dd                                t
          j        d             |d!d           d S )"Nr   r;   r   r   r   c                                          |           }                    ||                               |t                                         |t
                     d S r    )exprbooleanr*   r   rr   assertNotIsInstanceboolr   s      r   r   z'TclTest.test_exprboolean.<locals>.checkn  s\    __T**FVX...!!&#...$$VT22222r   r   r   r   r   ri   F)r[   falsenooffz"%s"z{%s})r(   trueyesr{   Tr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r!   r<   r   r   r   r   )r   r   valuer,   s   `  @r   test_exprbooleanzTclTest.test_exprbooleanj  s   kQQ	3 	3 	3 	3 	3 	3 	)S_555)S_eTBBB)S_jAAA(COV<<<b%0 	) 	)EE%E&5.%(((E&5.%((((/ 	( 	(EE%E&5.$'''E&5.$''''ij$mT"""!4(((&...ind###gti4d;;;j$nd###-t444.555(COW===gtr   c                       j          fd} |dd            |dd            |dd            |dd            |dd            |d	d            |d
d            |dd           d S )Nc           	      \                        d|           }                                r3                    ||                               |t                     d S                     || t          t	          |                    f                               |t                     d S Nr   )r<   r#   r*   r   rr   r3   r   r   s      r   r   z$TclTest.test_booleans.<locals>.check  s    XXfd++F   3  222%%fc22222ftSX-?-?&@AAA%%fc22222r   r   Tr   r{   r   Fr   r   z1 < 2z1 > 2)r!   r   s   ` @r   test_booleanszTclTest.test_booleans  s    k	3 	3 	3 	3 	3 	3 	fdeTdDgudEeUgtgur   c                 v   | j         }|                                 D ]}|                    dt          |                    }| j        r2|                     ||           |                     |t                     ^|                     |t          |                     |                     |t                     d S r   )r!   rf   r<   r   r#   r*   r   rr   )r   r,   ru   r   s       r   test_expr_bignumzTclTest.test_expr_bignum  s    k""$$ 	3 	3AXXfc!ff--F 3  +++%%fc2222  Q000%%fc2222	3 	3r   c           	           fd}                       |d           j        rdnd                                  |d           j        rdnd                                  |d          d                                  |d          d                                  |d          d                                  |d	          d	                                  |d
          d
                                  |d          d                                  |d          d           t          j        dk    r>                       |d          d                                  |d          d                                  |d           j        rdnd	                                  |d           j        rdnd                                  |d           j        rdnd                                            D ]7}                       ||           j        r|nt          |                     8ddddt          j        j        t          j        j        t          j        j         t          j        j         fD ]U} j        r                        ||          |           )                      t           ||                    |           V j        r |t          d                    } 
                    ||                                  |t          d                    t          d                                            |t          d                     t          d                      n                      t           |t          d                              t          d                                           t           |t          d                               t          d                                             |d           j        rdnd                                  |dd d!gg           j        rd"nd#           d S )$Nc                 <    j                             dd|           S )Nr   _)r!   r<   )r   r   s    r   	passValuez.TclTest.test_passing_values.<locals>.passValue  s    ;##E3666r   Tr(   Fr[   r   	   string€
   string💻str ing	   str ing½
   str ing€u   str ing💻r      <>   <€>   <>r2      str ing   string
   strÀings   stringu   str½ingr   r|         UUUUUU?naninfrZ   r   333333@z1 2 3.4r;   r   c)r;   )r   r  a {b c})r*   r#   r   platformrf   r   
float_infominmaxr   assertNotEqual)r   r  ru   r   s   `   r   test_passing_valueszTclTest.test_passing_values  s   	7 	7 	7 	7 	7 	4$2B*K$$LLL5))D4D+M55#NNN8,,h777>22NCCC#5668JKKK<00,???#3446FGGG#5668JKKK#9::/	1 	1 	1<7""YY'=>>') ) )YY'OPP+- - -=11*.*:L	N 	N 	N#455.2.>T**DT	V 	V 	V=11*.*:L	N 	N 	N""$$ 	N 	NAYYq\\0@+L11c!ffMMMMsD#.$cn&8>%%(:':< 	9 	9A  9  1q1111  yy||!4!4a8888 	M	%,,''A1%%%YYuU||44eEllCCCYYe}55e}EEEEU99U5\\#:#:;;U5\\JJJU99eEll]#;#;<<uU||mLLL#344-1-=L))9	N 	N 	NC#s#455.2.>M**I	O 	O 	O 	O 	Or   c                     d fd} j                             d|                                 j         j        j        d           d, j        d fd} fd} |dd            |dd	            |d
            |d            |d            |d           t          j        dk    r |dd            |dd            |d            |dd
            |dd            |dd            |dd            |d            |d            |d            |dd            |dd            |dd                                             D ]} ||t          |                     d!D ]} ||t          |                     d"t          j        j        t          j        j        t          j        j         t          j        j         fD ]} |||            |t          d#          |            |t          d#           |            |d$d            |d%d&            |d'd(gd)d*gd+g gd&           d S )-Nc                     | | S r    r   )argr   s    r   testfuncz+TclTest.test_user_command.<locals>.testfunc  s    FJr   r   )eqc                    || }d j                             d|           }                    t                      ||                               |t                      |||           d S )Nr   )r!   r<   r   r   )r   r   r!  rr   r   s       r   r   z(TclTest.test_user_command.<locals>.check  s{     F  U33A!!&#...Bvx   !!!S)))Bq(OOOOOr   c                 r                         t          |           |t          |          dz             d S )Ng|=)delta)assertAlmostEqualr   abs)actualr   r   s     r   float_eqz+TclTest.test_user_command.<locals>.float_eq  sG    ""5==(),X)> # @ @ @ @ @r   Tr(   Fr[   r   u   string½r  r  r   r  r	  r
  r2   ri   s   strings	   string€u   stringâ¬s   stringr   r  r  r  r  r  r  s   string€u   strÀingâ¬)r   r|   r  r  r  r   )rZ   )r`   )r   r   5 6r   z1 2 {3 4} {5 6} {}rZ   r`   r   r   r*  r    )r!   createcommandr   r"   deletecommandr*   r   r  rf   r   reprr  r  r  r   )r   r   r   r)  ru   r   r   s   `     @r   test_user_commandzTclTest.test_user_command  s2   	 	 	 	 	 	!!*h7774jAAA		d.> 		 		 		 		 		 		 		 			@ 	@ 	@ 	@ 	@ 	dCeShln !!!<7""E(*555E:NKKKb			i"""#%9:::m\***c2l !!!m\***!1222+-IJJJ""$$ 	 	AE!SVV! 	 	AE!T!WW+S^-?>%%(:':< 	" 	"AE!!!!!!eEllx((((uU||m))))b"*,@AAAq1$Ar*,@AAAAAr   c                    | j         j        j        }| j         j        j        }|                     t
          |           |                     t
          |dd           |                     t
          |d           dddddd	d
dddddddddddddg dfdddggdddgff |dddd          | j        rdndfg}| j        sd }nd!}| |d"d#d$d%d&d          |fgz  }d'| j        d(t          d)| j                                         }|D ]+\  }}| 	                     ||          |d*|d+|           ,|                     t          |d,           d S )-Nr;   r   r`   )r   )r   )ri   r   ){}ri   )z""r1  )z
a
 b	 c
 r;   r   r  )s
   a
 b	 c
 r2  )u   a €r;      €)u   a 💻r;   u   💻)s   a €r3  )s   a 💻r5  )s   a r5  )s	   ab cd)r/   zc d)r  r;   zb c)za b\ cr6  )r6  r6  )za 2)r;   r   )r;   r`   r7  )za 3.4)r;   3.4)r;   r  r9  )r   r   r   r  listrZ   r   r  r  )r(   r   r8  )12r4  u   â¬r8  )   r4     €r  dictcreater<  r4  r=  zwant objects? z, Tcl version: z, Tcl patchlevel: zarg=z, {)r!   r"   	splitlistr<   r   r   r#   rq   info_patchlevelr*   r   )r   rA  r<   	testcasesr   dbg_infor  ress           r   test_splitlistzTclTest.test_splitlist  s   KN,	{~")Y///)YS999)Y222/0)108@<%%( #$HC:sCj 12T&!S&))$($4 "  !#/
	6  	?>HH>HT&(B/6JJ
 	
		
 '''dk6Q6Q6S6S6SU! 	= 	=HCYYs^^SS-0SS((;= = = =(Is33333r   c           
         t           j        }| j        j        }d}|                      |||d          dddd           |                      |||          dddd           d}|                      |||d          d	dd
d           |                      |||          d	dd
d           |                     t          ||d           |                     t          ||d           |                    ddd	dddd          }|                      |||          | j        rd	ndddd           |                    dddd	dddd          }| j        sdddd}nd	ddd}|                      |||          |           d S )Nz#-a {1 2 3} -something foo status {}Fz1 2 3foori   )-a
-somethingstatus)r;   	somethingrK  )rI  rZ   r`   r   rJ  rH  rK  r0  rM  r0  z-a b -c )rI  r   r   r:  rI  rJ  rK  r   r>  r?  )	tkinter
_splitdictr!   r"   r*   r   RuntimeErrorr<   r#   )r   	splitdictr,   r  r   s        r   test_splitdictzTclTest.test_splitdictH  s   &	kn33U33%2>>	@ 	@ 	@3,,<<	> 	> 	> E3U33ETBB	D 	D 	D3,,%4@@	B 	B 	B 	,	3
CCC,	38IJJJhhviuhL L3,,#/<))W2/ /	0 	0 	0 hhvxYeXrK K 	J$5BGGHH&UbIIH3,,h77777r   c                 f    t           j         j        j        fd fd} |d            |d            |d            |d            |d            |d            |d	            |d
            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d            |d           d S )Nc                 2                         d| d          S )Nlindexr   )r<   )sr,   s    r   unpackz!TclTest.test_join.<locals>.unpackl  s    88Ha+++r   c           
      N                          | g                    |                                   | dg                    |                                    | gg                              |                                    | dgg                              |                                    | gdg                              |                                    | dgdg                              |            d S )Nr   )r*   )r   joinr   rW  s    r   r   z TclTest.test_join.<locals>.checkn  sG   VVDD%MM22E:::VVDD%$4$455u===VVFF44%	??$;$;<<eDDDVVFF44%+=+=$>$>??GGGVVFF44%!+=+=$>$>??GGGVVFF44%Q+@+@$A$ABBEJJJJJr   ri   r   zsp amzsp	amzsp
amz 	
z{spam}z{sp am}z"spam"z"sp am"z{"spam"}z"{spam}"zsp\amz"sp\am"z	"{}" "{}"z"\z"{z"}z
\z
{z
}z\
z{
z}
)rN  _joinr!   r"   )r   r   rY  r,   rW  s   ` @@@r   	test_joinzTclTest.test_joini  s   }kn	, 	, 	, 	, 	,	K 	K 	K 	K 	K 	K 	K 	b			fghhghihijjhjkeddfeefeer   c                     t          j        | t          j                   t          j        | t          j                   t          j        | t          j                   d S r    )r   check_disallow_instantiationr   Tcl_ObjTkttType	TkappTyper   s    r   test_new_tcl_objzTclTest.test_new_tcl_obj  sJ    ,T83CDDD,T83DEEE,T83EFFFFFr   N)1r   r   r   r$   r-   r0   r4   r7   r9   r=   r@   rE   rI   rL   rP   rR   rV   rX   r^   ra   rc   rf   rv   ry   r   r   r   r   r   r   r   
skipUnlessr   r  r   r   r   r   r   r   r   r  r.  rF  rR  r[  r   cpython_onlyra  r   r   r   r   r   (   s       8 8 80 0 0
> > >K K K5 5 5= = =2 2 2
7 7 7A A A0 0 0
3 3 3
. . .
1 1 1
3 3 36 6 68 8 8; ; ;5 5 5# # #2 2 2*7 7 76 6 6 0 0 06 6 6< < <": : :C C C X02DEE* * FE** #  #  #D% % %>; ; ;>& & &P  &	3 	3 	3.O .O .O`6B 6B 6Bp.4 .4 .4`8 8 8B# # #J G G G G Gr   r   c                      e Zd Zd Zej         ej        ee	k     d           ej
        edz   dd          d                                     Zej         ej        ee	k     d           ej
        edz   dd          d	                                     Zej         ej        ee	k     d           ej
        edz   d
d          d                                     ZdS )BigmemTclTestc                 ,    t                      | _        d S r    )r   r!   r   s    r   r$   zBigmemTclTest.setUp  s    eer   zneeds UINT_MAX < SIZE_MAXrZ   r   F)sizememusedry_runc                 b    d|z  }|                      t          | j        j        dd|d           d S )N r   indexr   )r   OverflowErrorr!   r<   )r   rg  r   s      r   test_huge_string_callz#BigmemTclTest.test_huge_string_call  s7     d
-)98WeUVWWWWWr   r`   c                    | j         j        }dd|z  z   }|                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j	        |           |                     t          |j
        |           |                     t          |j        |dd           |                     t          |j        d|d           |                     t          |j        |           |                     t          |j        d|           |                     t          |j
        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |           |                     t          |j        |t$                     |                     t          |j        |           d S )Nr(   rk  xr;   )r!   r"   r   rm  ro   rx   r~   r)   r   recordadderrorinforH   r]   r   r   r   rA  r+  r  r,  r   rg  r"   r   s       r   test_huge_string_builtinsz'BigmemTclTest.test_huge_string_builtins  s    [^cDj -E:::-u===->>>-%888-e<<<-E:::-%@@@-E3DDD-CDDD-e<<<-c5AAA-%@@@->>>-e<<<-???-u===-)95#FFF-)95AAAAAr   r   c                     | j         j        }dd|z  z   }|                     t          |j        |           |                     t          |j        |           |                     t          |j        d|           d S )Nr(   rk  rp  )r!   r"   r   rm  r   r]   rs  s       r   test_huge_string_builtins2z(BigmemTclTest.test_huge_string_builtins2  sq    
 [^cDj -e<<<-e<<<-c5AAAAAr   N)r   r   r   r$   r   rc  r   rb  r	   r
   
bigmemtestrn  rt  rv  r   r   r   re  re    sZ          X>13NOOWWq[EBBBX X CB PO X X>13NOOWWq[EBBBB B CB PO B, X>13NOOWWq[EBBBB B CB PO B B Br   re  c                      t           j        r6t                      } t          d|                     dd          d           d S d S )Nzpatchlevel =info
patchlevelT)flush)r   verboser   printr<   )r,   s    r   setUpModuler~    sK     Jeenchhv|<<DIIIIIIJ Jr   __main__)#r   localerer   r   r   warningstestr   test.supportr   r   import_moduler   rN  r   r   	_testcapir	   r
   ImportErrormaxsizetuplemaprr   TCL_VERSIONsplitrq   TestCaser   r   re  r~  r   mainr   r   r   <module>r     s     				     



 				        & & & & & & " " " " " " '=&z22             +111111111 + + +"{*Gnnn+ eCCX177<<==>>
A 
A 
A 
A 
A(# 
A 
A 
Aj	G j	G j	G j	G j	Gh j	G j	G j	GX.B .B .B .B .BH% .B .B .BbJ J J zHMOOOOO s   A A*)A*