
    ;eq                         d dl mZmZ d dlZd dlZd dlZd dl mZ d dlZej        Z	ddZ
ddZd Zd Z G d d	ej                  Zed
k    r ej                     dS dS )    )verbose
TestFailedNFc                    t           rN|r't          d                    | ||          d           n%t          d                    | |          d           	 | |z  }|r8|6||k    r0t           rt          d           t          | d|d|d|          |r|t	          |          t	          |          k    s|d |         |d |         k    rft           rt          d           t          t          |           dt          |          dt          |          dt          |                     d S t           rt          d	           d S d S # t          $ r  |s t           rt          d
           Y d S Y d S w xY w)Nz{!a} % {!a} =? {!a} ... )endz{!a} % {!a} works? ...noz % z == z != yeszoverflow (this is fine))r   printformatAssertionErrorlenreprOverflowError)	formatstrargsoutputlimit
overflowokresults         '/usr/lib/python3.11/test/test_format.py
testformatr      s    M 	M+229dFKK     *11)TBBLLLLT!  	em&(8(8 d !*DDD&&&&&"B C C C  	)FS[[((F6E6NF6E6N,J,J d	????DJJJJVd6lllL M M M M M  e /  - - - 	 	-+,,,,,,	- 	- 	--s   E #E:9E:c                    t          | t                    r)t          | ||||           |                     d          }n| }t	          |          }g }t          |t
                    s|f}t          |          }|d x}}	n<t          |t                    r|                    d          }n|}t	          |          }	t          |||||           t          |||	||           d S Nascii)
isinstancestrr   encode	bytearraytuple)
r   r   r   r   r   b_format	ba_formatb_argsb_output	ba_outputs
             r   
testcommonr%   2   s     )S!! 9dFE:>>>##G,,(##IFdE"" x4[[F~##99fc"" 	}}W--HHHh''	x5*===y&)UJ?????    c                    	 t          | |           t          d|z            # |$ r}}t          |          |k    rt          rt	          d           nHt          rt	          d           t	          d|dt          t          |                               Y d }~d S Y d }~d S d }~w t          rt	          d           t	          d            xY w)Nz"did not get expected exception: %sr	   r   zUnexpected :zUnexpected exception)r   r   r   r   r
   r   )r   r   	exceptionexcmsgexcs        r   test_excr,   J   s    H9d### =FGGG  A A As88v e#d-Cc#hh@@@@@@@@@      E$KKK$%%%s   $ CA,B!!+Cc                 t    t          | |||           t          |                     d          |||           d S r   )r,   r   )r   r   r)   r*   s       r   test_exc_commonr.   [   s>    Yi000Yg&&i@@@@@r&   c                       e Zd Zd Zd Zd Zd Zd Zd Ze	j
        d             Zd Ze	j
        d	             Zd
 Zd Zd Zd Zd Zd Zd Zd Zd ZdS )
FormatTestc                    t          ddd           t          ddd           t          dt          j        dfd	
           t          dddd	
           t          dddd	
           t          dddd	
           t          ddd           t          dd           t          dd           t          dd           t          dd           t          dd           t          dd           t          dd           t          dd           t          ddd           t          dd d!           t          d"dd#           t          d"d d$           t          d%dd&           t          d%d d'           d(}t          d%|d)           t          d%| d*           t          d+| d*           t          d,| d*           t          d-| d.           t          d/| d0           t          d1| d2           t          d3| d0           t          d4| d5           t          d4|d6           t          d7|d8           t          d9|d:           t          d;|d<           t          d=|d)           t          d>|d)           t          d?|d@           t          dA|dB           t          d%t          |          dCdD           dE}t          d|dF           t          d| dG           t          dH| dG           t          dI| dG           t          dJ| dK           t          dL| dM           t          dN| dO           t          dP| dM           t          dQ| dR           t          dQ|dS           t          dT|dU           t          dV|dW           t          dX|dY           t          dZ|dF           t          d[|dF           t          d\|d]           t          d^|d_           t          d`|da           t          db|dc           t          dd|de           t          df|dg           t          df| dh           t          di|dj           t          dk|dl           t          dm|dn           t          do|dp           t          do| dq           t          dr|ds           t          dt|du           t          dv|dn           t          dw|dx           t          dy|dz           t          d{|d|           t          d}|d~           t          d|d           t          d|d           t          d|d           t          d|d           d}t          d"|d           t          d"| d           t          d| d           t          d| d           t          d| d           t          d| d           t          d| d           t          d| d           t          d| d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d"|d           t          d|d           t          d| d           t          d|d           t          d|d           t          d|d           t          d|d           t          d| d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d           t          d|d¦           t          d|d           t          d|dĦ           t          d|d           t          d|dǦ           t          d|dĦ           t          d%ddʦ           t          d%dd̦           t          d%ddʦ           t          dfddΦ           t          ddddϦ           t          dddЦ           t          dddҦ           t          d"ddӦ           t          d%ddӦ           t          dfddԦ           t          ddddզ           t          dddʦ           t          ddd̦           t          d"ddʦ           t          d"dd̦           t          dddܦ           t          dddަ           t          rt          dߦ           t          ddt          d           t          ddt          d           t          d%dt          d           t          d%dt          d           t          ddt          d           t          ddt          d           d S )Nz%% %z%.1d)   1z%.*dr4   T)r   z%.100dd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001z%#.117xw0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001z%#.118xx0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001z%f      ?z1.000000z%#.*g)m   ц>)n   r<   )r=   gQ2<bz%12.*f)i@ r:   z%#.*Gz%#.*fz%#.*Fz%x
   al    h] 
174876e800z%o121351035564000z%d10100000000000l   
~l!]c 123456789012345678901234567890z-123456789012345678901234567890z%5dz%31dz%32dz  -123456789012345678901234567890z%-32dz -123456789012345678901234567890 z%032dz -0123456789012345678901234567890z%-032dz%034dz"-000123456789012345678901234567890"0000123456789012345678901234567890z%0+34dz"+000123456789012345678901234567890z%+34dz"   +123456789012345678901234567890z%34dz"    123456789012345678901234567890z%.2dz%.30dz%.31d0123456789012345678901234567890z%32.31dz  0123456789012345678901234567890123456________________________   l   E#=*H<V4$ 1234567890abcdef12345z-1234567890abcdef12345z%5xz%22xz%23xz -1234567890abcdef12345z%-23xz-1234567890abcdef12345 z%023xz-01234567890abcdef12345z%-023xz%025xz-0001234567890abcdef1234500001234567890abcdef12345z%0+25xz+0001234567890abcdef12345z%+25xz   +1234567890abcdef12345z%25xz    1234567890abcdef12345z%.2xz%.21xz%.22x01234567890abcdef12345z%23.22xz 01234567890abcdef12345z%-23.22xz01234567890abcdef12345 z%X1234567890ABCDEF12345z%#X0X1234567890ABCDEF12345z%#x0x1234567890abcdef12345z-0x1234567890abcdef12345z%#27xz    0x1234567890abcdef12345z%#-27xz0x1234567890abcdef12345    z%#027x0x00001234567890abcdef12345z%#.23x0x001234567890abcdef12345z-0x001234567890abcdef12345z%#27.23xz  0x001234567890abcdef12345z	%#-27.23xz0x001234567890abcdef12345  z	%#027.23xz%#+.23xz+0x001234567890abcdef12345z%# .23xz 0x001234567890abcdef12345z%#+.23Xz+0X001234567890ABCDEF12345z
%#+027.23Xz+0X0001234567890ABCDEF12345z
%# 027.23Xz 0X0001234567890ABCDEF12345z	%#+27.23Xz +0X001234567890ABCDEF12345z
%#-+27.23xz+0x001234567890abcdef12345 z
%#- 27.23xz 0x001234567890abcdef12345 l   KSp.']w9
  12345670123456701234567012345670z!-12345670123456701234567012345670z%5oz%33oz%34oz" -12345670123456701234567012345670z%-34oz"-12345670123456701234567012345670 z%034oz"-012345670123456701234567012345670z%-034oz%036oz$-00012345670123456701234567012345670$000012345670123456701234567012345670z%0+36oz$+00012345670123456701234567012345670z%+36oz$   +12345670123456701234567012345670z%36oz$    12345670123456701234567012345670z%.2oz%.32oz%.33o!012345670123456701234567012345670z%34.33oz" 012345670123456701234567012345670z%-34.33oz"012345670123456701234567012345670 z%#o"0o12345670123456701234567012345670z#-0o12345670123456701234567012345670z%#38oz&    0o12345670123456701234567012345670z%#-38oz&0o12345670123456701234567012345670    z%#038o&0o000012345670123456701234567012345670z%#.34o$0o0012345670123456701234567012345670z%-0o0012345670123456701234567012345670z%#38.34oz&  0o0012345670123456701234567012345670z	%#-38.34oz&0o0012345670123456701234567012345670  z	%#038.34oz%#+.34oz%+0o0012345670123456701234567012345670z%# .34oz% 0o0012345670123456701234567012345670z	%#+38.34oz& +0o0012345670123456701234567012345670z
%#-+38.34oz&+0o0012345670123456701234567012345670 z
%#- 38.34oz& 0o0012345670123456701234567012345670 z
%#+038.34oz&+0o00012345670123456701234567012345670z
%# 038.34oz& 0o00012345670123456701234567012345670z%#.33o#0o012345670123456701234567012345670z%#.32oz%035.33o#00012345670123456701234567012345670z	%0#35.33o*   42iz-42g      E@0x10X10o1r   0o000x00X0B   i"   i%gg?z1.1z%#gz1.10000Testing exceptionszincomplete formatz% %sz2unsupported format character '%' (0x25) at index 2z-%d format: a real number is required, not str   1z/%d format: a real number is required, not bytesz*%x format: an integer is required, not strQ	@z,%x format: an integer is required, not float)	r%   sysmaxsizefloatr   r
   r.   
ValueError	TypeError)selfbigs     r   test_common_formatzFormatTest.test_common_formatb   sE    	4S!!!64%%%6CK?t<<<<8T $(,	. 	. 	. 	. 	9d %0 !	" 	" 	" 	" 	9d %1 !	" 	" 	" 	"
 	4,,, 	7-...7-...7.///8]+++
 	7.///7.///7.///7.///4S!!!4|4444T"""47774T"""4~666,4>???4#@AAA53$ ABBB6C4!BCCC6C4!CDDD7SD"DEEE7SD"DEEE8cT#EFFF7SD"FGGG7C!EFFF8S"FGGG7C!EFFF63 DEEE63 @AAA7C!ABBB7C!BCCC9c#EFFF4s%EqIII%456664#788853$ 89996C4!9:::6C4!:;;;7SD";<<<7SD";<<<8cT#<===7SD"=>>>7C!<===8S"=>>>7C!<===63 ;<<<63 78887C!89997C!9:::9c#<===:s$=>>>456665#89995#899953$ :;;;7C!>???8S"?@@@8S"?@@@8S"=>>>8cT#?@@@:s$ABBB;%BCCC;%BCCC9c#?@@@9c#?@@@9c#?@@@ 	<&CDDD<&CDDD;%BCCC<&CDDD<&CDDD04@AAA4#BCCC53$ CDDD6C4!DEEE6C4!EFFF7SD"FGGG7SD"FGGG8cT#GHHH7SD"HIII7C!GHHH8S"HIII7C!GHHH63 FGGG63 BCCC7C!CDDD7C!DEEE9c#GHHH:s$HIII4@AAA5#CDDD53$ EFFF7C!IJJJ8S"JKKK8S"JKKK8S"HIII8cT#JKKK:s$LMMM;%MNNN;%MNNN9c#JKKK9c#JKKK;%MNNN<&NOOO<&NOOO<&NOOO<&NOOO7C!DEEE8S"GHHH8S"FGGG:s$IJJJ;%JKKK 	4T"""4e$$$4t$$$5!U###5!U###5!U###5!U###4C   4C   5!U###5!U###4t$$$4&&&4t$$$4&&&4e$$$5#y))) 	(&'''R-@AAA:L	N 	N 	Nc9G	I 	I 	IdII	K 	K 	Kc9D	F 	F 	FdIF	H 	H 	H 	H 	Hr&   c                    t          ddd           t          ddd           t          ddd           t          ddd           t          rt          d           t          d	d
t          d           t          ddt
          d           t          ddt
          d           t          ddt          d           t          dt          j        d
z   t          d           t          ddt
          d           t          ddt
          d           t          ddt
          d           t          dk    r-	 dt          dfz   t          d          # t          $ r Y d S w xY wd S )Nz%ru   ͸z'\u0378'z%au   ʹu   'ʹ'z'\u0374'rf   zabc %br4   z2unsupported format character 'b' (0x62) at index 5re   r5   zmust be real number, not strz	no formatz4not all arguments converted during string formattingz%cz%c arg not in range(0x110000)rh   z%c requires int or charab   x%*d!"%*d"%(maxsize, -127) should fail)r   r   r
   r,   rl   rm   r   ri   
maxunicoderj   r   MemoryErrorrn   s    r   test_str_formatzFormatTest.test_str_format  s   4;///4;///4:...4;///  	(&'''1jE	G 	G 	G 	sI'EFFFc9G	I 	I 	Ir=*IJJJs~a'0	2 	2 	2 	tY(ABBBtY(ABBBtY(ABBBgFwo%% !!DEEE    	 s   ,E 
EEc                    t          ddd           t          ddd           t          dt          d          d           t          ddd           t          ddd	            G d
 dt                    } |            }t          ddd           t          dt          d          d           t          d|d           t          dt          d          d           t          ddd           t          dt          d          d           t          d|d           t          dt          d          d           t          ddd           t          ddd           t          ddd           t          ddd           t          ddd           t          ddd           t          ddd           t          ddd           t          rt          d           t          ddt          d           t          ddt          d            t          d!dt          d"           t          d!dt          d"           t          d!t          d          t          d"           t          dd#t          d$           t          dd%t          d$           t          dd&d'z  t          d$           t          dd(t          d)           t          dd*t          d)           t          ddt          d)           t          dd+t          d,           t          dd-t          d,           t          d.k    r-	 d/t          d0fz   t          d1          # t          $ r Y d S w xY wd S )2Ns   %c         Zs   %5cA   s       As   %-5cs   A    c                       e Zd Zd ZdS )=FormatTest.test_bytes_and_bytearray_format.<locals>.FakeBytesc                     dS )N   123r2   r{   s    r   	__bytes__zGFormatTest.test_bytes_and_bytearray_format.<locals>.FakeBytes.__bytes__J  s    vr&   N)__name__
__module____qualname__r   r2   r&   r   	FakeBytesr   I  s#            r&   r   s   %bs   abcs   defr   s   %ss   %arh   s   3.14s   ghis   b'ghi'jkls   'jkl'u   Մs   '\u0544's   %rrf   s   %gr5   z float argument required, not strrg   z"float argument required, not bytess	   no formatz3not all arguments converted during bytes formattingrr   z%c arg not in range(256)         s   Zaz5%c requires an integer in range(256) or a single byteYXczR%b requires a bytes-like object, or an object that implements __bytes__, not 'str'Wdru   rv   rw   rx   )r%   r   object
memoryviewr   r
   r,   rm   r   rj   r   rz   )rn   r   fbs      r   test_bytes_and_bytearray_formatz*FormatTest.test_bytes_and_bytearray_format?  s    	5!W%%%5$%%%5)D//400062x(((7B)))	 	 	 	 	 	 	 	 Y[[5&&)))5)F++V4445"f%%%5*V,,f5555&&)))5)F++V4445"f%%%5*V,,f555 	5$(((5&),,,5%***5(L1115$(((5&),,,5%***5(L111  	(&'''Y(JKKKi)MNNNq)F	H 	H 	HtYF	H 	H 	Hy	F	H 	H 	HM*	, 	, 	,]*	, 	, 	,3*	, 	, 	,yG	I 	I 	IYG	I 	I 	IiG	I 	I 	IiE	F 	F 	F 	iE	F 	F 	F gFwo%% !!DEEE    	 s   !L< <
M
	M
c                     t          ddd           t          ddd           t          ddd           t          dd	d
           d S )Nza br2   za%cb)r   za%sb)zc dzac dbs   a%sb)s   c ds   ac db)r%   r   r{   s    r   test_nulzFormatTest.test_nul  sP    62v&&&64(((69h///7J	22222r&   c                 `   t          ddd           |                     t          dd          d           |                     t          dd          d           |                     t          d	d
          d           |                     t          dd          d           |                     t          dd          d           |                     t          dd          d           |                     t          dd          d           |                     t          d	d          d           |                     t          dd          d           |                     t          dd          d           |                     t          dd          d           |                     t          dd          d           |                     t          d	d          d           |                     t          dd           d!           |                     t          dd"          d#           d S )$Nu   €=%fr9   u   €=1.000000abcu    <5u	   abc  {   u	   123  g(@u    <6u
   12.3                  u    <4u   0j  y      ?       @u    <8u   (1+2j)  u    >5u	     abcu	     123u    >6u
     12.3u    >8u     (1+2j)u    >4u     0ju    ^5u	    abc u	    123 u    ^6u
    12.3 u    ^8u    (1+2j) u    ^4u    0j )r   assertEqualr   r{   s    r   test_non_asciizFormatTest.test_non_ascii  s
   ;(9:::z224EFFFZ002CDDDj113EFFFJ//1ABBBj113GHHHz224EFFFZ002CDDDj113EFFFj113GHHHJ//1ABBBz224EFFFZ002CDDDj113EFFFj113GHHHJ//1ABBBBBr&   c                 j   	 t          j        t           j                  }t          j        t           j        d           nD# t           j        $ r2}|                     d                    |                     Y d }~nd }~ww xY w	 t          j                    }|d         }|d         }|d         }t          dd          }|r|                     ||           |                     |	                    |d          d           t          d	d          }|r|                     ||           |                     ||           |                     |	                    |d          d
|z   dz              t          j        t           j        |           d S # t          j        t           j        |           w xY w)N zCannot set locale: {}thousands_sepdecimal_pointgroupingi[n	123456789g     J@12345)
locale	setlocaleLC_ALLErrorskipTestr   
localeconvassertInr   replace)rn   oldlocerrr   seppointr   texts           r   test_localezFormatTest.test_locale  s   	?%fm44FV]B////| 	? 	? 	?MM188==>>>>>>>>	?	4*,,J_-C/E!*-H)S))D )c4(((T\\#r22K@@@&#&&D )c4(((MM%&&&T\\#r22FUNS4HIIIV]F33333FV]F3333s$   =A   B(A<<BC+F !F2c                 r   d}|                      d|z  |           |                      d|z  |           |                      d|z  |           |                      d|z  |           |                      d|z  |           |                      d                    |          |           |                      d                    |          |           |                      d	                    |          |           |                      d
                    |          |           |                      d                    |          |           |                      d                    |          |           |                      |dz  |           |                      |                                |           d S )Nabcdez%sz%.5sz%.10sz%1sz%5sz{0}z{0:s}z{0:.5s}z{0:.10s}z{0:1s}z{0:5s}r2   )assertIsr   )rn   r   s     r   test_optimisationszFormatTest.test_optimisations  s}   dTk4(((ftmT***gnd+++edlD)))edlD)))ell4(($///gnnT**D111i&&t,,d333j''--t444hood++T222hood++T222dRi&&&dkkmmT*****r&   c                    d}|                      t          |d          d           |                      t          |d          d           |                     t                    5 }t          |dt          j        dz   z             d d d            n# 1 swxY w Y   t          |          }|                      t          |d          d           |                      t          |d          d	           |                     t                    5 }t          |dt          j        dz   z             d d d            d S # 1 swxY w Y   d S )
N333333?z.0fr5   z.3fz1.200.%sfr4   z1+0jz1.200+0.000j)r   r   assertRaisesrl   ri   rj   complex)rn   fcmcs       r   test_precisionzFormatTest.test_precision  s   5))3///5))7333z** 	2b1fa0111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 AJJ5))62225))>:::z** 	2b1fa0111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2s$   %!BBB!D<<E E c                 V   ddl m} d}|                     t                    5 }t	          |d|dz   z             d d d            n# 1 swxY w Y   t          |          }|                     t                    5 }t	          |d|dz   z             d d d            d S # 1 swxY w Y   d S )Nr   )INT_MAXr   r   r4   )	_testcapir   r   rl   r   r   )rn   r   r   r   r   s        r   test_precision_c_limitsz"FormatTest.test_precision_c_limits  s3   %%%%%%z** 	.b1f!,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. AJJz** 	.b1f!,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s#   AA
A
:BB"%B"c                    |                      ddz  d           |                      ddz  d           |                      t          dd          d           |                      t          dd          d           |                      t          dd	          d
           |                      t          dd          d           d S )Nz%.3gg     @z1.5e+03z%#.3gz1.50e+03z.3gz#.3gg   @ugAz.6gz1.23e+07z#.6gz1.23000e+07)r   r   r{   s    r   #test_g_format_has_no_trailing_zerosz.FormatTest.test_g_format_has_no_trailing_zeros  s    &)4446):666..	::://<<<
E22J???
F33]CCCCCr&   c                     t          j        d          }|                     t          |          5  d                    d           d d d            d S # 1 swxY w Y   d S )NzCannot specify ',' with ','.z{:,,}r4   reescapeassertRaisesRegexrl   r   rn   	error_msgs     r   (test_with_two_commas_in_format_specifierz3FormatTest.test_with_two_commas_in_format_specifier      I<==	##J	:: 	 	NN1	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   AAAc                     t          j        d          }|                     t          |          5  d                    d           d d d            d S # 1 swxY w Y   d S )NzCannot specify '_' with '_'.z{:__}r4   r   r   s     r   ,test_with_two_underscore_in_format_specifierz7FormatTest.test_with_two_underscore_in_format_specifier  r   r   c                     t          j        d          }|                     t          |          5  d                    d           d d d            d S # 1 swxY w Y   d S )N Cannot specify both ',' and '_'.z{:,_}r4   r   r   s     r   8test_with_a_commas_and_an_underscore_in_format_specifierzCFormatTest.test_with_a_commas_and_an_underscore_in_format_specifier       I@AA	##J	:: 	 	NN1	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	r   c                     t          j        d          }|                     t          |          5  d                    d           d d d            d S # 1 swxY w Y   d S )Nr   z{:_,}r4   r   r   s     r   7test_with_an_underscore_and_a_comma_in_format_specifierzBFormatTest.test_with_an_underscore_and_a_comma_in_format_specifier  r   r   c           
      r   dD ]2}|                      |          5  d}t          j        d| dt          |          j         d          }|                     t          |          5  d| d                    |           d d d            n# 1 swxY w Y   |                     t          |          5  t          ||           d d d            n# 1 swxY w Y   |                     t          |          5  t          d	           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   4d S )
N)y              (@   g      (@rA   )valuez%MzInvalid format specifier 'z' for object of type ''z	xx{value:z}yyz f'xx{value:{bad_format_spec}}yy')	subTestr   r   typer   r   rl   r   eval)rn   r   bad_format_specr   s       r    test_better_error_message_formatz+FormatTest.test_better_error_message_format
  sc   * 	= 	=EE** = = #'i !<$3!< !<$(KK$8!< !< !< = = ++J<< K K6666==E=JJJK K K K K K K K K K K K K K K ++J<< 3 35/2223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ++J<< = =;<<<= = = = = = = = = = = = = = == = = = = = = = = = = = = = =	= 	=s~   AD*'BD*BD*BD*4CD*CD*CD*7DD*DD*DD**D.	1D.	c                     t          j        d          }|                     t          |          5  d                    d           d d d            d S # 1 swxY w Y   d S )Nu=   Invalid format specifier '%ЫйЯЧ' for object of type 'str'u   {a:%ЫйЯЧ}r?   )r?   r   )rn   str_errs     r   test_unicode_in_error_messagez(FormatTest.test_unicode_in_error_message  s    )KM M##J88 	* 	*""S")))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AAAc                    |                      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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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.           |                      dd/d0           |                      dd1d2           |                      dd3d4           d S )5Ng       z.1fz-0.0g{Gzr   z0.0g        zz.1fzz6.1fz   0.0g      z  -1.0g{Gz?zz.2fz0.00gMbP?gMbPzz.1ez0.0e+00zz.1Ez0.0E+00zz.2ez	-1.00e-03zz.2gz-0.001zz.2%z-0.10%gưg
ףp=
?z0.1g
ףp=
z-0.1z z.0fz 0z+z.0fz+0z-z.0fr`   z-1r   z0.0+0.0jy              y        {Gz?y       {Gzzz>6.1fzzz-0.0zz>z6.1fzzzz0.0zx>z6.1fzxxx0.0u
   🖤>z6.1fu   🖤🖤🖤0.0)r   r{   s    r   test_negative_zerozFormatTest.test_negative_zero%  s   Cv...D///Be,,, 	Bu---B111C222C...C...Bu---D///Bv...C///D000E&111By111C	222By111C	222F));777F))8444F))8444M00%888G**E222L//777M00&999G**F333L//888C...D000C...C...C---C...C...C...C
333D444D444E*555C(333C))8444C))8444C,,.?@@@@@r&   c                    t          j        d          }|                     t          |          5  dd d d d            n# 1 swxY w Y   |                     t          |          5  dd d d d            n# 1 swxY w Y   t          j        d          }|                     t          |          5  dd d d d            n# 1 swxY w Y   |                     t          |          5  dd d d d            n# 1 swxY w Y   t          j        d	          }|                     t          |          5  d
dz   d d d            n# 1 swxY w Y   |                     t          |          5  ddz   d d d            d S # 1 swxY w Y   d S )Nz Invalid format specifier '.*z.*'r   zz+ffzz&Negative zero coercion (z) not allowedzdxzsz unsupported format character 'z'z%z.1fs   %z.1f)r   compiler   rl   r   r   s     r   test_specifier_z_errorz!FormatTest.test_specifier_z_error^  s   JABB	##J	:: 	 	JJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	##J	:: 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 IFGG	##J	:: 	 	III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	##J	:: 	 	KKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 I@AA	##J	:: 	 	aKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	##J	:: 	 	qLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sk   AAA'A88A<?A<2CC
C)C::C>C>4EE
E
,E??FFN)r   r   r   rp   r|   r   r   r   r   supportcpython_onlyr   r   r   r   r   r   r   r   r   r   r   r   r2   r&   r   r0   r0   `   s^       zH zH zHxF F FBHF HF HFT3 3 3C C C*4 4 42 + + +&2 2 2 	. 	. 	.	D 	D 	D  
  
  
  
= = =** * *7A 7A 7Ar    r&   r0   __main__)NNF)test.supportr   r   r   ri   r   r   unittestMAX_Py_ssize_trj   r   r%   r,   r.   TestCaser0   r   mainr2   r&   r   <module>r      s   , , , , , , , ,  



 				       

 ! ! ! !F@ @ @ @0H H H"A A A
O O O O O" O O Od zHMOOOOO r&   