
    ;eX                       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Zd dlm	Z	 d dl
mZ  G d de j                  Z G d d          Z G d d	e          Z G d
 deej                  Z G d deej                  Z G d deej                  Z G d de          Z G d dej                  Z G d de          Z G d de          Z G d deej                  Z G d deej                  Z G d de          Z G d deej                  Z G d  d!eej                  Z G d" d#e          Z G d$ d%eej                  Z G d& d'ej                  Z G d( d)e          Z  G d* d+eej                  Z! G d, d-eej                  Z" G d. d/          Z#d0 Z$ G d1 d2ej                  Z% G d3 d4ej                  Z& G d5 d6ej                  Z' G d7 d8ej                  Z( G d9 d:ej                  Z) G d; d<eej                  Z* G d= d>ej                  Z+ G d? d@ej                  Z,e-dAk    r ej.                     dS dS )B    N)support)	os_helperc                   6    e Zd Zd Zd Zd Zd Zd Zd ZeZ	dS )
SortedDictc                 N    t          | j                                                  S N)sorteddataitemsselfs    -/usr/lib/python3.11/test/test_configparser.pyr   zSortedDict.items   s    dioo''(((    c                 N    t          | j                                                  S r   )r	   r
   keysr   s    r   r   zSortedDict.keys   s    dinn&&'''r   c                 >    d |                                  D             S )Nc                     g | ]
}|d          S )    ).0is     r   
<listcomp>z%SortedDict.values.<locals>.<listcomp>   s    +++!+++r   )r   r   s    r   valueszSortedDict.values   s    ++djjll++++r   c                 D    t          |                                           S r   )iterr   r   s    r   	iteritemszSortedDict.iteritems   s    DJJLL!!!r   c                 D    t          |                                           S r   )r   r   r   s    r   iterkeyszSortedDict.iterkeys   s    DIIKK   r   c                 D    t          |                                           S r   )r   r   r   s    r   
itervalueszSortedDict.itervalues   s    DKKMM"""r   N)
__name__
__module____qualname__r   r   r   r   r   r    __iter__r   r   r   r   r      so        ) ) )( ( (, , ," " "! ! !# # # HHHr   r   c                   `    e Zd ZdZdZdZdZdZej	        Z
dZej        Zej        ZddZddZdS )	CfgParserTestCaseClassF)=:);#TNc                     t          || j        | j        | j        | j        | j        | j        | j        | j        | j	        
  
        } | j
        di |}|S )N)
defaultsallow_no_value
delimiterscomment_prefixesinline_comment_prefixesempty_lines_in_values	dict_typestrictdefault_sectioninterpolationr   )dictr-   r.   r/   r0   r1   r2   r3   r4   r5   config_class)r   r,   	argumentsinstances       r   	newconfigz CfgParserTestCaseClass.newconfig0   sk    .!2$($@"&"<n; 0,
 
 
	 %4$11y11r   c                 Z    |                      |          }|                    |           |S r   )r:   read_string)r   stringr,   cfs       r   
fromstringz!CfgParserTestCaseClass.fromstring@   s*    ^^H%%
v	r   r   )r!   r"   r#   r-   r.   r/   r0   r1   configparser_default_dictr2   r3   DEFAULTSECTr4   _UNSETr5   r:   r?   r   r   r   r&   r&   %   su        NJ!( *IF".O 'M         r   r&   c                       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S )BasicTestCasec                 (   g d}| j         r|                    d           |                                 ddg}|                                }|                                 | j        } |||           |                    d          }|                                  |||           d |D             }|                                 |                    | j                   |                                  |||           |d                                         }t          t          |                    } |||           |                                }t          t          |                    }|                     t          |          t          |                     |D ]\  }} |||j
                    ||                                || 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d          d             ||                    d!d"          d#           | j         r  ||                    dd$          d             ||                    ddd%          d	            ||                    ddddi&          d           |                     t$          j                  5  |                    d'd           d d d            n# 1 swxY w Y   |                     t$          j                  5  |                    dd(           d d d            n# 1 swxY w Y    ||                    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                  5  |                    dd+           d d d            n# 1 swxY w Y   |                     |                    ddd-%          d           |                     |                    dd.d-%          d-            ||                    dd.d/%          d/           |                     t$          j                  5  |                    dd.           d d d            n# 1 swxY w Y    ||                    ddd0%          d            ||                    dd1d2%          d2            ||                    dd1d0%          d0           |                     t$          j                  5  |                    dd1           d d d            n# 1 swxY w Y    ||                    d3dd0%          d0           | j         rD ||                    dd$d%          d             ||                    dd4d%          d            ||d         d         d	            ||d
         d         d           |d         } ||j
        d           |                     |j        |           |                     t.                    5  d5|_
        d d d            n# 1 swxY w Y   |                     t.                    5  d6|_        d d d            n# 1 swxY w Y    ||d         d            ||d         d            ||d         d         d            ||d         d         d            ||d         d         d            ||d         d         d            ||d7         d         d8           | j         r ||d         d$         d             ||d                             dd          d	            ||d                             dd%          d	            ||d                             dddi&          d           |                     t0                    5  |d'         d          d d d            n# 1 swxY w Y   |                     t0                    5  |d         d(          d d d            n# 1 swxY w Y   |                     t0                    5  |d'                             dd%           d d d            n# 1 swxY w Y    ||d                             d(d          d            ||d                             d(d%          d            ||d                             d(          d             ||d
                             dd           d            ||d
                             dd %          d           |                     t0                    5  |d)                             dd            d d d            n# 1 swxY w Y    ||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            ||d                             dd0%          d            ||d                             d1d2          d2            ||d                             d1d2%          d2            ||d                             d1d0          d0            ||d                             d1d0%          d0            ||d                             d1          d            | j         r ||d                             d$d          d             ||d                             d$d%          d             ||d                             d4d          d            ||d                             d4d%          d           d9|| j                 d:<   d;|| j                 d<<   |                     |                    d                     |                     |                    dd                     |                     |                    d                     |                     |                    | j                             |                     |                    dd          d=           |                     |                    dd          d>           |                     |                    dd          d?           |                     |                    dd:                     |                     |                    dd:                     |                     |                    | j        d:                     |                     |                    dd:                     |                     |                    | j        d:                     |                     t$          j                  5 }|                    d@d           d d d            n# 1 swxY w Y   |                     |j        j        dA            ||                    d7d          d8           |d= |                     d|v            |                     t0                    5  |d= d d d            n# 1 swxY w Y   |                     t@                    5  || j        = d d d            n# 1 swxY w Y   |d
         d= |                     d|d
         v            |                     t0                    5  |d
         d= d d d            n# 1 swxY w Y   |                     d<|d
         v            |                     t0                    5  |d
         d<= d d d            n# 1 swxY w Y   || j                 d<= |                     d<|d
         v            |                     t0                    5  || j                 d<= d d d            n# 1 swxY w Y   |                     t0                    5  |d@         d= d d d            d S # 1 swxY w Y   d S )BN)
Commented BarFoo BarInternationalized Stuff	Long LineSection\with$weird%characters[	Spaces
Spacey BarSpacey Bar From The BeginningTypesThis One Has A ] In ItNoValue)bazqwe)foobar3rN   c                     g | ]}|S r   r   r   sections     r   r   z,BasicTestCase.basic_test.<locals>.<listcomp>d       '''W'''r   rH   rT   bar1rM   bar2rU   rR   rS   rG   bar4rL   key with spacesvalueanother with spacessplat!rO   int*   42float)\(?z0.44booleanF123strange but acceptablerP   forksspoonsoption-without-valuefallbackvarszNo Such Foo Barzno-such-foozNo Such Spacey Bar   zno-such-int18g        zno-such-floatz0.0Tzno-such-booleanyeszNo Such Typeszno-such-option-without-valuezName is read-onlyzParser is read-onlyrJ   7this line is much, much longer than my editor
likes it.1
this_value2
that_valuez4remove_option() failed to report existence of optionz'remove_option() failed to remove optionzIremove_option() failed to report non-existence of option that was removedNo Such Section)rx   )!r-   appendsortsectionsassertEqualr   r4   r	   listlennamer,   getgetintassertAlmostEqualgetfloat
getbooleanassertRaisesr@   NoSectionErrorNoOptionErrorassertIsparserAttributeErrorKeyError
assertTrueremove_sectionassertFalse
has_optionremove_option	exceptionargs
ValueError)	r   r>   EFLeqr   rX   cms	            r   
basic_testzBasicTestCase.basic_testH   s   
 
 
  	 HHY	_- KKMM	
1aHH455	
1a ('B'''		%&&&	
1a./5577477OO
1aHHJJ477OOQQ((( 	# 	#MD'BtW\""""
2;;=="T12333 	266)U##V,,,
266,&&///
26615996BBB
26615995AAA
266/5))6222
266/5))5111
266(-..888
266(122H===
299We$$b)))
266'5!!4(((r{{7G<<dCCC
266'7##V,,,
2==),,e444
266'5!!#;<<<
266*G44h??? 	@Brvvi!788$??? 	266)UU633V<<<
266)U%688%@@@|:;; 	- 	-FF$e,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-|9:: 	- 	-FF9m,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-
266#UU6;;UCCC
266)]U6;;UCCC
266,655v>>>
266&6==tDDD
299Web9112666
299Wmb9992>>>
299Wmd9;;TBBB|9:: 	. 	.IIg}---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.r{{7G47  +  9  9:>	@ 	@ 	@r{{7O47  +  9  9:=	? 	? 	?
2;;w%;@@%HHH|9:: 	2 	2KK111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2
2==)d=;;UCCC
2=="3e=DD	 	 	
2=="3d=CCTJJJ|9:: 	6 	6MM'#4555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6
2==)d=CCTJJJ 	.Brvvi!7%vHH$OOOBrvvi!?$  & &',. . . 	2i=(((
2lE"F+++45
7<8999gnb)))~.. 	/ 	/.GL	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/~.. 	3 	32GN	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3
75>6"""
75>5!!!
2ou%v...
2ou%u---
2h<)*G444
2h<-.999
2k?5!E	G 	G 	G 	<Br)}34d;;;
2i=UE**F333
2i=UU33V<<<
2i=U%88%@@@x(( 	) 	) !%((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)x(( 	) 	)yM-((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)x(( 	= 	= !%%ee%<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=
2i=]E22E:::
2i=]U;;UCCC
2i=]++T222
2lt,,f555
2l55v>>>x(( 	6 	6#$((555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6
2g;eR(("---
2g;eb112666
2g;mR00"555
2g;mb992>>>
2g;mT22D999
2g;md;;TBBB
2g;m,,d333r'{33GSAA4HHHr'{33G=@  4  B  BCG	I 	I 	Ir'{33OSII3OOOr'{33O=@  4  B  BCF	H 	H 	H
2g;77???
2g;%@@%HHH
2g;00$777
2g;!!)T22E:::
2g;!!)d!;;UCCC
2g;!!"3U;;UCCC
2g;!!"3e!DD	 	 	
2g;!!"3T::DAAA
2g;!!"3d!CCTJJJ
2g;!!"344d;;; 	.Br)}  !7??FFFBr)}  !7% HH$OOOBr)}  !?GGOOOBr)}  !?$ ! & &',. . . 254 .144 . 	))(33444x1BCCDDD**844555**4+?@@AAA((E::N	P 	P 	Py%88=	? 	? 	?)))U;;(	) 	) 	) 	i>>???)))\BBCCC(()=|LLMMMy,??@@@))$*>MMNNN|:;; 	7r.666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7*,@AAA
266+u%%E	G 	G 	G wKB'''x(( 	 	7	 	 	 	 	 	 	 	 	 	 	 	 	 	 	z** 	) 	)4'(	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)|U#"\"22333x(( 	( 	(< '	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(<(88999x(( 	/ 	/< .	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/t#$\2L)99:::x(( 	7 	74'(6	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7x(( 	- 	-$%e,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-sn  R  RR*SSS%XXX,[[[^^	^8bbb1cc	c	h66h:=h:i66i:=i:kk	k	)oooHAH'H'AH+H.AH+J&AJ6J6AJ:J=AJ:K	AK0K0AK4K7AK4L;
AMMAMMAMN
AN)N)AN-N0AN-O9APPAPPAPP9
AQQAQQAQc                    d                     | j        | j                  }| j        r|dz  }|                     |          }|                     |           | j        r|                     t          j	                  5  |
                    t          j        d                     | j                                       d d d            n# 1 swxY w Y   |                     t          j                  5  |
                    t          j        d                     | j                                       d d d            d S # 1 swxY w Y   d S |
                    t          j        d                     | j                                       |
                    t          j        d                     | j                                       d S )Nax  [Foo Bar]
foo{0[0]}bar1
[Spacey Bar]
foo {0[0]} bar2
[Spacey Bar From The Beginning]
  foo {0[0]} bar3
  baz {0[0]} qwe
[Commented Bar]
foo{0[1]} bar4 {1[1]} comment
baz{0[0]}qwe {1[0]}another one
[Long Line]
foo{0[1]} this line is much, much longer than my editor
   likes it.
[Section\with$weird%characters[	]
[Internationalized Stuff]
foo[bg]{0[1]} Bulgarian
foo{0[0]}Default
foo[en]{0[0]}English
foo[de]{0[0]}Deutsch
[Spaces]
key with spaces {0[1]} value
another with spaces {0[0]} splat!
[Types]
int {0[1]} 42
float {0[0]} 0.44
boolean {0[0]} NO
123 {0[1]} strange but acceptable
[This One Has A ] In It]
  forks {0[0]} spoons
z[NoValue]
option-without-value
z                    [Duplicate Options Here]
                    option {0[0]} with a value
                    option {0[1]} with another value
                z                    [And Now For Something]
                    completely different {0[0]} True
                    [And Now For Something]
                    the larch {0[1]} 1
                z                [Duplicate Options Here]
                option {0[0]} with a value
                option {0[1]} with another value
            z                [And Now For Something]
                completely different {0[0]} True
                [And Now For Something]
                the larch {0[1]} 1
            )formatr.   r/   r-   r?   r   r3   r   r@   DuplicateOptionErrorr<   textwrapdedentDuplicateSectionErrorr   config_stringr>   s      r   
test_basiczBasicTestCase.test_basic(  sL   < F4?D122= 	>  	)M __]++; 	*""<#DEE . .x 0 F4?++	 -  - . . .. . . . . . . . . . . . . . . ""<#EFF . .x 0
 F4?++ -  - . . .. . . . . . . . . . . . . . . . . . NN8? , t''	) ) * * * NN8? ,
 t'') ) * * * * *s&   =A C		CC3A E  EEc                    ddiddiddddddddii d	d
dddddddddddddid
}| j         r|                    ddd ii           |                                 }|                    |           |                     |           | j        r|                     t          j                  5  |                    ddiddid           d d d            n# 1 swxY w Y   |                     t          j	                  5  |                    dd d!d"i           d d d            d S # 1 swxY w Y   d S |                    ddiddid#           |                    dd d!d"i           d S )$NrT   rZ   r[   rU   rS   )rT   rR   r\   rs   	BulgarianDefaultEnglishDeutsch)zfoo[bg]rT   zfoo[en]zfoo[de]r^   r`   )r]   r_   rb   re   Frh   )ra   rd   rf   {   ri   rj   )
rH   rM   rN   rG   rJ   rK   rI   rL   rO   rP   rQ   rk   keykey2value2)rt   r   zDuplicate Options Herezwith a valuezwith another value)optionOPTION)rX   SECTION)
r-   updater:   	read_dictr   r3   r   r@   r   r   )r   configr>   s      r   test_basic_from_dictz"BasicTestCase.test_basic_from_dictk  s    v v . .
  
  2 ' $$	( ( $+'/ 
  -	  'K(
 (
R  	MM*D   
 ^^
V; 	""<#EFF  ))                  
 ""<#DEE  ,"0"6/ /                     LL!7+"H-     LL(,2+ +     s$   -CCC D((D,/D,c                 2   |                                  }|                    d           |                    d           |                    d           |                                }|                                 | j        } ||g d           |                    ddd            ||                    d          dg            ||                    dd          dd           |                     t          j
                  5  |                    ddd           d d d            n# 1 swxY w Y   |                     |                    dd                     |                     |                    dd                     |                    ddd	           d
D ],}|                     |                    d|          d           - ||                    d          dg            ||                    d          dg           |                    dd            ||                    d          g            |                     d                    | j        d                             } ||                    d          dg            ||                    dd          d           |                     d                    | j        d                   ddi          }|                     |                    dd                     d S )NAaB)r   r   r   r^   b@could not locate option, expecting case-insensitive option namesA-B	A-B valuea-bzA-bza-Br   9has_option() returned false for option which should existr   3[MySection]
Option{} first line   
	second line   
r   	MySectionr   Optionfirst line
second line[section]
nekey{}nevalue
r   r,   rX   Key)r:   add_sectionr{   rz   r|   setoptionsr   r   r@   r   r   r   r   r   r?   r   r.   )r   r>   r   r   opts        r   test_case_sensitivityz#BasicTestCase.test_case_sensitivity  sF   ^^
s
s
sKKMM	
1ooo
sC!!!
2::c??SE"""
266#sWM	O 	O 	O|:;; 	& 	&FF3W%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	c3//000sC00111
sE;'''/ 	M 	MCOOc3''KM M M M 	2::c??UG$$$
2::c??SE"""
c"""
2::c??B __ELL"$ $% % 	2::k""XJ///
266+x((*CDDD __ 006tq7I0J0J',Wo  7 7 	i7788888s   D,,D03D0c           	         |                                  }i |d<   ddi|d<   i |d<   d |D             }|                                 | j        }| j        } ||t	          dd| j        dg                      ||d                                         dh            ||d         d         dd           |                     t                    5  d|d         d<   d d d            n# 1 swxY w Y   | 	                    d|d         v            d|d         d	<   d
D ] }| 	                    ||d         v d           ! ||d                                         dh            ||d                                         dh           |d         d=  ||d                                         i            | 
                    d                    | j        d                             } ||d                                         dh            ||d         d         d           | 
                    d                    | j        d                   ddi          }| 	                    d|d         v            d S )Nr   r   r^   r   c                     g | ]}|S r   r   rW   s     r   r   zFBasicTestCase.test_case_sensitivity_mapping_access.<locals>.<listcomp>  rY   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rX   )r:   rz   r|   assertCountEqualr	   r4   r   r   r   r   r?   r   r.   )r   r>   r   r   elem_eqr   s         r   $test_case_sensitivity_mapping_accessz2BasicTestCase.test_case_sensitivity_mapping_access  s   ^^3.33''B'''	'
1fc3 4c:;;<<<
2c7<<>>C5!!!
2c73<M	O 	O 	Ox(( 	# 	#"BsGCL	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	r#w'''$3/ 	M 	MCOOr#wKM M M M 	2c7<<>>E7###
2c7<<>>C5!!!sGCL3### __ELL"$ $% % 	2k?!!H:...
2k?8$&?@@@ __ 006tq7I0J0J',Wo  7 7 	I./////s   C&&C*-C*c                 "   |                      ddi          }|                     |                    | j        d          dd           |                      ddi          }|                     |                    | j        d          dd           d S )NrT   BarFoor   z<could not locate option, expecting case-insensitive defaults)r:   r|   r   r4   r   r>   s     r   test_default_case_sensitivityz+BasicTestCase.test_default_case_sensitivity	  s    ^^UEN++FF4'//N	P 	P 	P ^^UEN++FF4'//J	L 	L 	L 	L 	Lr   c                 n   |                                  }|                     |t          j        d                    | j        d                              |                     |t          j        d                    | j        d                              |                     |t          j        d          }|                     |j        d           | j	        s|                     |t          j        d          }|                     |j        d           t          j        d          }| j        d         d	k    rt          j        }|f}nt          j        }|dd
f}t          |d          5 }|                     |||          }d d d            n# 1 swxY w Y   |                     |j        |           d S d S )Nz[Foo]
{}val-without-opt-name
r   r   No Section!
)<???>r   r   z[Foo]
  wrong-indent
)r   cfgparser.3r'   z.  # INI with as many tricky parts as possible
utf-8encoding)r:   parse_errorr@   ParsingErrorr   r.   MissingSectionHeaderErrorr|   r   r-   r   findfileopen)r   r>   etrickyerrorexpectedfs          r   test_parse_errorszBasicTestCase.test_parse_errors  s   ^^\644:F4?1;M4N4N	P 	P 	P 	\644:F4?1;M4N4N	P 	P 	P R!G,. .!>???" 	/  \%> 9; ;AQVZ000%m44Fq!S(($1"9$>"AMOfw/// 31$$R223 3 3 3 3 3 3 3 3 3 3 3 3 3 3QVX.....	/ 	/s   )FFFc                     t          |d          r|}nt          j        |          }|                     |          5 }|                    |           d d d            n# 1 swxY w Y   |j        S )Nreadline)hasattrioStringIOr   	read_filer   )r   r>   excsrcsior   s         r   r   zBasicTestCase.parse_error/  s    3
## 	#CC+c""Cs## 	rLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	|s   AA#&A#c                 $   |                                  }|                     |                                g d           |                     |                    d          d           |                     t          j                  5  |                    d           d d d            n# 1 swxY w Y   |                     t          j                  5  |	                    ddd           d d d            n# 1 swxY w Y   | 
                    |t          j        dd          }|                     |j        d           |                    d           | 
                    |t          j        dd          }|                     |j        d           d S )	Nz0new ConfigParser should have no defined sectionsr   z5new ConfigParser should have no acknowledged sectionsrT   barr^   )rT   )r   rT   )r:   r|   r{   r   has_sectionr   r@   r   r   r   	get_errorr   r   r   r   r>   r   s      r   test_query_errorszBasicTestCase.test_query_errors8  s   ^^K	M 	M 	M..$	% 	% 	% |:;; 	 	JJu	 	 	 	 	 	 	 	 	 	 	 	 	 	 	|:;; 	* 	*FF5%)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*NN2|:E5II***
uNN2|95%HH00000s$   B((B,/B,C66C:=C:c                     	 |                     ||           |                     d|j        d|j                   d S # |$ r}|cY d }~S d }~ww xY w)Nzexpected exception type .)r   failr"   r#   )r   r>   r   rX   r   r   s         r   r   zBasicTestCase.get_errorI  s    	<FF7F### III)9)9; < < < < <  	 	 	HHHHHH	s   ? AAAAc                    |                      d                    | j        d                             }t          dd          D ]}|                     |                    dd|z                       |                     |                    dd|z                       |                     t          |j        dd	|z             d S )
Nz[BOOLTEST]
T1{equals}1
T2{equals}TRUE
T3{equals}True
T4{equals}oN
T5{equals}yes
F1{equals}0
F2{equals}FALSE
F3{equals}False
F4{equals}oFF
F5{equals}nO
E1{equals}2
E2{equals}foo
E3{equals}-1
E4{equals}0.1
E5{equals}FALSE AND MOREr   equalsr      BOOLTESTzt%dzf%dze%d)	r?   r   r.   ranger   r   r   r   r   )r   r>   xs      r   test_booleanzBasicTestCase.test_booleanR  s    __' (.vT_Q5Gv'H'H! $ q! 	D 	DAOOBMM*eai@@AAAR]]:uqyAABBBj mZD D D D	D 	Dr   c           	      B   |                                  }|                    d           |                     t          j                  5 }|                    d           d d d            n# 1 swxY w Y   |j        }|                     t          |          d           |                     |j        d           | j	        r\|                     t          j                  5 }|
                    t          j        d                    | j        d                             d           d d d            n# 1 swxY w Y   |j        }|                     t          |          d	           |                     |j        d
           |                     t          j                  5 }|                    ddddi           d d d            n# 1 swxY w Y   |j        }|                     t          |          d           |                     |j        d           d S d S )Nr   zSection 'Foo' already exists)r   NNz                    [Foo]
                    will this be added{equals}True
                    [Bar]
                    what about this{equals}True
                    [Foo]
                    oops{equals}this won't
                r   r   	<foo-bar>sourcezFWhile reading from '<foo-bar>' [line  5]: section 'Foo' already exists)r   r  r   r   valzis really `opt`)r   OPTzIWhile reading from '<dict>': option 'opt' in section 'Bar' already exists)r   r   z<dict>N)r:   r   r   r@   r   r   r|   strr   r3   r<   r   r   r   r.   r   r   )r   r>   r   r   s       r   test_weird_errorszBasicTestCase.test_weird_errorsk  s   ^^
u|ABB 	"bNN5!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"LQ!?@@@!4555; 	E""<#EFF L"x 0 F$/!"4F55 7  7 @K  L L LL L L L L L L L L L L L L L L ASVV &O P P PQV%<===""<#DEE PeU;L%M%MNOOOP P P P P P P P P P P P P P PASVV &M N N NQV%CDDDDD)	E 	Es7   	A++A/2A/"A	D77D;>D;&GGGc                    d                     | j        | j        d         | j                  }| j        r|dz  }|                     |          }dD ]}t          j                    }|                    ||           | j        d         }|rd                     |          }d                     || j        	          }| j        r|d
z  }| 	                    |
                                |           d S )Na8  [Long Line]
foo{0[0]} this line is much, much longer than my editor
   likes it.
[{default_section}]
foo{0[1]} another very
 long line
[Long Line - With Comments!]
test {0[1]} we        {comment} can
            also      {comment} place
            comments  {comment} in
            multiline {comment} values
r   )commentr4   z![Valueless]
option-without-value
)TF)space_around_delimitersz {} z[{default_section}]
foo{equals}another very
	long line

[Long Line]
foo{equals}this line is much, much longer than my editor
	likes it.

[Long Line - With Comments!]
test{equals}we
	also
	comments
	multiline

)r   r4   z"[Valueless]
option-without-value

)r   r.   r/   r4   r-   r?   r   r   writer|   getvalue)r   r   r>   r
  output	delimiterexpect_strings          r   
test_writezBasicTestCase.test_write  s1    1Fq1I(,(<  > > 	  	%M
 __]++'4 	? 	?#[]]FHHV5LHMMM*I& 5"MM)44	 V9,0,@  B B " " 
 V__..>>>>;	? 	?r   c                    |                      d                    | j        d                             } G d dt                    }|                    ddd           |                    dd |d                     |                    dd	d           |                    dd	 |d                     |                    ddd           |                    dd	d           d S )
N[sect]
option1{eq}foo
r   r   c                       e Zd ZdS )2BasicTestCase.test_set_string_types.<locals>.mystrN)r!   r"   r#   r   r   r   mystrr    s        Dr   r  sectoption1splatoption2)r?   r   r.   r  r   )r   r>   r  s      r   test_set_string_typesz#BasicTestCase.test_set_string_types  s    __ 006$/!:L0M0MO O	 	 	 	 	C 	 	 	
vy'***
vy%%..111
vy'***
vy%%..111
vy'***
vy'*****r   c                 2   | j         d         dk    r|                     d           t          j        d          }|                                 }|                    |dgd          }|                     ||g           |                     |                    dd	          d
           |                                 }|                    |d          }|                     ||g           |                     |                    dd	          d
           |                                 }|                    t          j	        |          d          }|                     ||g           |                     |                    dd	          d
           |                                 }|                    t          j	        |          |gd          }|                     |||g           |                     |                    dd	          d
           |                                 }|                    dgd          }|                     |g            |                                 }|                    g d          }|                     |g            d S )Nr   r'   incompatible formatcfgparser.1nonexistent-filer   r   rH   rT   newbar)
r.   skipTestr   r   r:   readr|   r   pathlibPath)r   file1r>   parsed_filess       r   test_read_returns_file_listz)BasicTestCase.test_read_returns_file_list  sV   ?1$$MM/000 //^^ww'9:WwMMw///	5118<<<^^wwuww77w///	5118<<<^^www|E22WwEEw///	5118<<<^^wwU 3 3U;gwNNu~666	5118<<<^^ww 23gwFFr***^^wwrGw44r*****r   c                 ,   | j         d         dk    r|                     d           t          j        d                                          }|                                 }|                    |d          }|                     ||g           |                                 }|                    dd          }|                     |g            |                                 }|                    |dgd          }|                     ||g           d S )Nr   r'   r  r  r   r   s   nonexistent-file)r.   r!  r   r   encoder:   r"  r|   )r   file1_bytestringr>   r&  s       r   0test_read_returns_file_list_with_bytestring_pathz>BasicTestCase.test_read_returns_file_list_with_bytestring_path  s
   ?1$$MM/000"+M::AACC^^ww/'wBB(8'9:::^^ww2WwEEr***^^ww 02EFQXwYY(8'9:::::r   c                 j    |                      d                    | j        d                             S )Nah  [Foo]
bar{equals}something %(with1)s interpolation (1 step)
bar9{equals}something %(with9)s lots of interpolation (9 steps)
bar10{equals}something %(with10)s lots of interpolation (10 steps)
bar11{equals}something %(with11)s lots of interpolation (11 steps)
with11{equals}%(with10)s
with10{equals}%(with9)s
with9{equals}%(with8)s
with8{equals}%(With7)s
with7{equals}%(WITH6)s
with6{equals}%(with5)s
With5{equals}%(with4)s
WITH4{equals}%(with3)s
with3{equals}%(with2)s
with2{equals}%(with1)s
with1{equals}with

[Mutual Recursion]
foo{equals}%(bar)s
bar{equals}%(foo)s

[Interpolation Error]
name{equals}%(reference)s
r   r   )r?   r   r.   r   s    r   get_interpolation_configz&BasicTestCase.get_interpolation_config  s8    *. +1&8J&*K*K1M M 	Mr   c                    |                      d                    | j                  ddi          }t          |                    dddi                    }|                                 |                     ||           |                     t          j	                  5  |                    d           d d d            d S # 1 swxY w Y   d S )	Nz
            [section]
            name {0[0]} %(value)s
            key{0[1]} |%(name)s|
            getdefault{0[1]} |%(default)s|
        default	<default>r   rX   r^   rn   zno such section)
r?   r   r.   r}   r   rz   r|   r   r@   r   )r   r   r>   r   s       r   check_items_configz BasicTestCase.check_items_config  s   __ 
 F4?##y+.F  H H )7G*<==>>	H%%%|:;; 	( 	(HH&'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   !CCCc                 
   |                      d                    | j                  ddi          }|                     |                                d         d           |                     |                                d         d           |                     |                                d         d           |                     t                    5  |                                 d d d            d S # 1 swxY w Y   d S )	N
            [section1]
            name1 {0[0]} value1
            [section2]
            name2 {0[0]} value2
            [section3]
            name3 {0[0]} value3
        r/  r0  r   r   section1section2section3)r?   r   r.   r|   popitemr   r   r   s     r   test_popitemzBasicTestCase.test_popitem)  s&   __  F4?##y+.F  H H 	a*555a*555a*555x(( 	 	JJLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   C88C<?C<c                    |                      ddi          }|                     |                    | j        d          dd           ddd|d<   |                     |                                dg           |                     t          |d                                                   h d	           |                                 |                     t          |                                          t                                 |                     t          || j                                                           dh           d S )
NrT   r   r   r   value1r   )r  r  zing>   rT   r  r  )r:   r|   r   r4   r{   r   r   clearr   s     r   
test_clearzBasicTestCase.test_clear8  s"   ^^UEN++FF4'//N	P 	P 	P "*h??6
111RZ__..//1N1N1NOOO



R[[]]++SUU333R 45::<<==wGGGGGr   c                 *	   |                      d                    | j                  ddi          }|                     t	          |d                                                   ddh           |                     t	          |d                                                   d	dh           |                     t	          |d
                                                   ddh           |                     |d         d         d           |                     |d         d	         d           |                     |d
         d         d           |                     |                                g d           ddi|d<   |                     t	          |d                                                   ddh           |                     |d         d         d           |                     d	|d                    |                     |                                g d           i |d
<   |                     t	          |d
                                                   dh           |                     d|d
                    |                     |                                g d           || j                 || j        <   | 	                    t	          || j                                                           t	                                 i || j        <   |                     t	          || j                                                           t	                                 |                     t	          |d                                                   dh           |                     t	          |d                                                   dh           |                     t	          |d
                                                   t	                                 |                     |                                g d           |d         |d<   |                     t	          |d                                                   dh           d S )Nr3  nameDvalueDr   r4  name1namedr5  name2r6  name3r:  r   value3)r4  r5  r6  name22value22)
r?   r   r.   r|   r   r   r{   assertNotInr4   assertNotEqualr   s     r   test_setitemzBasicTestCase.test_setitemD  s   __  F4?##w.A  C C 	R
^002233gw5GHHHR
^002233gw5GHHHR
^002233gw5GHHHJ0(;;;J0(;;;J0(;;;(L(L(LMMM"I.:R
^002233h5HIIIJ19==="Z.111(L(L(LMMM:R
^002233gY???"Z.111(L(L(LMMM#%d&:#;4 C4#7 8 = = ? ?@@#%%HHH#%4 R 45::<<==suuEEER
^002233gY???R
^002233hZ@@@R
^002233SUU;;;(L(L(LMMMJ:R
^002233hZ@@@@@r   c                    | j         r|                     d           t          j        d                    | j        d                             }|                                 }|                     t          j	                  5  |
                    |           d d d            n# 1 swxY w Y   |                     |                    dd          d           |                     |d         d         d           d S )Nz2if no_value is allowed, ParsingError is not raisedzC            [DEFAULT]
            test {0} test
            invalidr   DEFAULTtest)r-   r!  r   r   r   r.   r:   r   r@   r   r<   r|   r   )r   invalidr>   s      r   test_invalid_multiline_valuez*BasicTestCase.test_invalid_multiline_valuej  s%    	PMMNOOO/ # vdoa011
 

 ^^|899 	$ 	$NN7###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$	622F;;;Iv.77777s   B$$B(+B(N)r!   r"   r#   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r'  r+  r-  r1  r8  r=  rJ  rO  r   r   r   rE   rE   F   s       [- [- [-@A* A* A*FJ J JX'9 '9 '9T&0 &0 &0PL L L/ / /8  1 1 1"< < <D D D2E E E>4? 4? 4?l+ + ++ + +B; ; ;$M M M6( ( (  
H 
H 
H$A $A $AL8 8 8 8 8r   rE   c                        e Zd Zej        ZdZdS )StrictTestCaseTN)r!   r"   r#   r@   RawConfigParserr7   r3   r   r   r   rQ  rQ  z  s        /LFFFr   rQ  c                   L    e Zd Zej        Zd Zd Zd Zd Z	d Z
d Zd Zd Zd	S )
ConfigParserTestCasec                    |                                  }| j        } ||                    dd          d            ||                    dd          d            ||                    dd          d           |                     |t          j        dd          }| j        t          j        k    r|                     |j        d	           d S t          | j        t          j
                  r|                     |j        d	           d S d S )
Nr   r   z%something with interpolation (1 step)bar9z.something with lots of interpolation (9 steps)bar10z/something with lots of interpolation (10 steps)bar11)rX  r   5something %(with11)s lots of interpolation (11 steps))r-  r|   r   r   r@   InterpolationDepthErrorr5   rC   r   
isinstanceLegacyInterpolation)r   r>   r   r   s       r   test_interpolationz'ConfigParserTestCase.test_interpolation  s<   **,,
266%!HIII
266%  ;	= 	= 	=
266%!!<	> 	> 	>NN2|CUGTT!444QV &I J J J J J*L,LMM 	JQV &I J J J J J	J 	Jr   c                    |                                  }|                     |t          j        dd          }|                     |j        d           |                     |j        d           |                     |j        d           | j        t          j	        k    r|                     |j
        d           d S t          | j        t          j                  r|                     |j
        d           d S d S )NInterpolation Errorr   	reference)r   r_  z%(reference)sr`  )r-  r   r@   InterpolationMissingOptionErrorr|   r`  rX   r   r5   rC   r   r[  r\  r   s      r    test_interpolation_missing_valuez5ConfigParserTestCase.test_interpolation_missing_value  s   **,,NN2|K0&: :k222$9:::6***!444QV &B C C C C C*L,LMM 	CQV &B C C C C C	C 	Cr   c                 4    |                      g d           d S )N)r/  r0  )
getdefaultz|<default>|)r   z|value|)r   r^   r1  r   s    r   
test_itemszConfigParserTestCase.test_items  s3     !4 !4 !4 	5 	5 	5 	5 	5r   c                    |                      d                    | j        d                             }|                     |                    dd          d           | j        t          j        k    r,|                     |                    dd          d           d S t          | j        t          j	                  rK| 
                    t                    5  |                    dd           d d d            d S # 1 swxY w Y   d S d S )	Nzc[section]
option1{eq}xxx
option2{eq}%(option1)s/xxx
ok{eq}%(option1)s/%%s
not_ok{eq}%(option2)s/%%sr   r  rX   okzxxx/%snot_okz
xxx/xxx/%s)r?   r   r.   r|   r   r5   r@   rC   r[  r\  r   	TypeErrorr   s     r   test_safe_interpolationz,ConfigParserTestCase.test_safe_interpolation  sK   __ 9 :@$(OA$6 :@ :8 :8	9 9 		400(;;;!444RVVIx88,GGGGG*L,LMM 	,""9-- , ,y(+++, , , , , , , , , , , , , , , , , ,	, 	,s   C==DDc                 j   |                      d                    | j        d                             }|                     |                    dd          d           |                     t          |j        ddd           |                     t          |j        ddd           |                     t          |j        ddd	           |                     |                    dd          d           |                    dd
d           |                     |                    dd
          d           d S )Nr  r   r  r  r  rT   %foofoo%f%oor  foo%%barzfoo%bar)r?   r   r.   r|   r   r   r   r   r   s     r   #test_set_malformatted_interpolationz8ConfigParserTestCase.test_set_malformatted_interpolation  s   __ 006$/!:L0M0MO O 		22E:::*bffiHHH*bffiHHH*bffiHHH	22E::: 	vy*---	22I>>>>>r   c                    |                      d                    | j        d                             }|                     t          |j        ddd           |                     t          |j        ddd           |                     t          |j        ddt                                 |                     t          |j        ddd           |                     t          |j        ddd           |                     t          |j        ddt                                 |                     t          |j        dd	d
           |                     t          |j        d	           d S )Nr  r   r  r  r  r   g      ?r  r   zinvalid opt name!)r?   r   r.   r   rk  r   objectr   r   s     r   test_set_nonstring_typesz-ConfigParserTestCase.test_set_nonstring_types  s/   __ 006$/!:L0M0MO O 	)RVVYBBB)RVVYDDD)RVVYIII)RVVYBBB)RVVYDDD)RVVYIII)RVVS:MNNN)R^S99999r   c                 z    |                                  }|                     t          |j        | j                   d S r   )r:   r   r   r   r4   r   s     r   test_add_section_defaultz-ConfigParserTestCase.test_add_section_default  s4    ^^*bnd6JKKKKKr   c                    |                      ddi          }|                     || j                 d         d           |                     || j                                     d          d           |                      ddi          }|                     || j                 d         d	           |                     || j                                     d          d           d
S )zbpo-23835 fix for ConfigParserr   333333@r   rt   z2.4r   @r   z5.2N)r:   r|   r4   r   r   r   s     r   test_defaults_keywordz*ConfigParserTestCase.test_defaults_keyword  s    ^^aX^..D01#6>>>r$"67@@EEsKKK^^c3Z^00D01#6>>>r$"67@@EEsKKKKKr   N)r!   r"   r#   r@   ConfigParserr7   r]  rb  rg  rl  rr  ru  rw  r{  r   r   r   rT  rT    s        ,LJ J J C C C5 5 5, , ,? ? ? : : :L L LL L L L Lr   rT  c                   |    e Zd Zej        ZdZ ej        d          	                                Z
d Zd Zd Zd ZdS )#ConfigParserTestCaseNoInterpolationNz
        [numbers]
        one = 1
        two = %(one)s * 2
        three = ${common:one} * 3

        [hexen]
        sixteen = ${numbers:two} * 8
    c                    |                      |d         d         d           |                      |d         d         d           |                      |d         d         d           |                      |d         d	         d
           d S )Nnumbersonert   twoz%(one)s * 2threez${common:one} * 3hexensixteenz${numbers:two} * 8)r|   r   s     r   assertMatchesIniz4ConfigParserTestCaseNoInterpolation.assertMatchesIni  s    Iu-s333Iu-}===Iw/1DEEEGY/1EFFFFFr   c                 d    |                      | j                  }|                     |           d S r   )r?   inir  r   s     r   test_no_interpolationz9ConfigParserTestCaseNoInterpolation.test_no_interpolation  s/    __TX&&b!!!!!r   c                 ~    |                                  }|                     |                    d                     d S N )r:   assertIsNoner<   r   s     r   test_empty_casez3ConfigParserTestCaseNoInterpolation.test_empty_case  s7    ^^"..,,-----r   c                      G d dt           j                  } |            }|                    | j                   |                     |           d S )Nc                       e Zd ZdZdS )bConfigParserTestCaseNoInterpolation.test_none_as_default_interpolation.<locals>.CustomConfigParserN)r!   r"   r#   _DEFAULT_INTERPOLATIONr   r   r   CustomConfigParserr    s        %)"""r   r  )r@   r|  r<   r  r  )r   r  r>   s      r   "test_none_as_default_interpolationzFConfigParserTestCaseNoInterpolation.test_none_as_default_interpolation  sm    	* 	* 	* 	* 	*!: 	* 	* 	*  !!
tx   b!!!!!r   )r!   r"   r#   r@   r|  r7   r5   r   r   stripr  r  r  r  r  r   r   r   r~  r~    s        ,LM
(/  	 	 
 G G G" " ". . ." " " " "r   r~  c                       e Zd Zej        Z ej                    5   ej        de	            ej
                    Zddd           n# 1 swxY w Y   d ZdS )'ConfigParserTestCaseLegacyInterpolationignoreNc                    |                      d                    | 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 S )Nr  r   r  r  r  rT   rn  ro  rp  r  rq  )r?   r   r.   r|   r   r   r   s     r   rr  zKConfigParserTestCaseLegacyInterpolation.test_set_malformatted_interpolation  sH   __ 006$/!:L0M0MO O 		22E:::
vy&)))	22F;;;
vy&)))	22F;;;
vy&)))	22F;;; 	vy*---	22J?????r   )r!   r"   r#   r@   r|  r7   warningscatch_warningssimplefilterDeprecationWarningr\  r5   rr  r   r   r   r  r    s        ,L	 	 	"	" ; ;h(:;;;88::; ; ; ; ; ; ; ; ; ; ; ; ; ; ;@ @ @ @ @s   !AAAr  c                       e Zd Zd ZdS ),ConfigParserTestCaseInvalidInterpolationTypec                    t           j        ddfD ]w}|                     |          5  |                     t                    5  t          j        |           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   xd S )Nrb   za string)r^   r5   )r@   ExtendedInterpolationsubTestr   rk  r|  )r   r^   s     r   *test_error_on_wrong_type_for_interpolationzWConfigParserTestCaseInvalidInterpolationType.test_error_on_wrong_type_for_interpolation  s2   "82
K 	C 	CEE** C C&&y11 C C -EBBBBC C C C C C C C C C C C C C CC C C C C C C C C C C C C C C	C 	Cs5   A<A%A<%A))A<,A)-A<<B 	B 	N)r!   r"   r#   r  r   r   r   r  r    s(        C C C C Cr   r  c                       e Zd ZdZdZdZdS ))ConfigParserTestCaseNonStandardDelimitersz:=$//"Nr!   r"   r#   r.   r/   r0   r   r   r   r  r  %  !        J")r   r  c                       e Zd ZdZdS )-ConfigParserTestCaseNonStandardDefaultSectiongeneralN)r!   r"   r#   r4   r   r   r   r  r  +  s        OOOr   r  c                   Z    e Zd Zej        Zd                    dd          Zd Zd Z	d Z
dS )MultilineValuesTestCasezSI'm having spam spam spam spam spam spam spam beaked beans spam spam spam and spam! 	
c                    |                                  }t          d          D ]m}d                    |          }|                    |           t          d          D ]1}|                    |d                    |          | j                   2nt          t          j        dd          5 }|	                    |           d d d            d S # 1 swxY w Y   d S )Nd   z	section{}
   zlovely_spam{}wr   r   )
r:   r   r   r   r   wonderful_spamr   r   TESTFNr  )r   r>   r   sjr   s         r   setUpzMultilineValuesTestCase.setUp5  s   ^^s 	J 	JA""1%%ANN12YY J Jq/0033T5HIIIIJ)"C'::: 	aHHQKKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   .CCCc                 B    t          j        t          j                   d S r   )osunlinkr   r  r   s    r   tearDownz MultilineValuesTestCase.tearDown?  s    
	)"#####r   c                 D   |                                  }t          t          j        d          5 }|                    |           d d d            n# 1 swxY w Y   |                     |                    dd          | j                            dd                     d S )Nr   r   section8lovely_spam4r  
)	r:   r   r   r  r   r|   r   r  replace)r   cf_from_filer   s      r    test_dominating_multiline_valuesz8MultilineValuesTestCase.test_dominating_multiline_valuesB  s     ~~'')"W555 	&""1%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&))*nEE,44VTBB	D 	D 	D 	D 	Ds   AAAN)r!   r"   r#   r@   r|  r7   r  r  r  r  r  r   r   r   r  r  /  sg        ,L,-4WS&-A-A   $ $ $D D D D Dr   r  c                   4    e Zd Zej        Zd Zd Zd Zd Z	dS )RawConfigParserTestCasec                 <   |                                  }| j        } ||                    dd          d            ||                    dd          d            ||                    dd          d            ||                    dd          d	           d S )
Nr   r   z*something %(with1)s interpolation (1 step)rV  z3something %(with9)s lots of interpolation (9 steps)rW  z5something %(with10)s lots of interpolation (10 steps)rX  rY  )r-  r|   r   r   r>   r   s      r   r]  z*RawConfigParserTestCase.test_interpolationO  s    **,,
266%7	9 	9 	9
266%  @	B 	B 	B
266%!!B	D 	D 	D
266%!!B	D 	D 	D 	D 	Dr   c                 4    |                      g d           d S )N)rd  )re  z|%(default)s|)r   z
|%(name)s|)r   z	%(value)srf  r   s    r   rg  z"RawConfigParserTestCase.test_items[  s3     !8 !8 !8 	9 	9 	9 	9 	9r   c                 V   |                                  }|                    d           |                    ddd           |                    ddg d           |                    ddddi           |                     |                    dd          d           |                     |                    dd          g d           |                     |                    dd          ddi           |                    d	           |                    d	d
d           |                     |                    d	d
          d           |j        t          j        u rKd |_        |                    ddd           |                     |                    dd          d           d S d S )Nz
non-stringra   r   r}   )r   r   r         r         r6   pign!	@r   zthis is sickTc                     | S r   r   )r   s    r   <lambda>zBRawConfigParserTestCase.test_set_nonstring_types.<locals>.<lambda>q  s    q r   )	r:   r   r   r|   r   _dictr@   rA   optionxformr   s     r   ru  z0RawConfigParserTestCase.test_set_nonstring_typesa  s   ^^
|$$$
|UA&&&
|V%>%>%>???
|VdG_555e44a888f55222	4 	4 	4f55gGGG
s
sND)))^44d;;;8|111 )[BNFF<A&&&RVVL!44a88888 21r   c                 l   |                      t                    5 }|                     ddi           ddd           n# 1 swxY w Y   |j        }|                     t          |          d           |                     ddi          }|                     || j                 d         d           dS )	z-bpo-23835 legacy behavior for RawConfigParserr   ry  r   Nz%'int' object has no attribute 'lower'r   rz  r   )r   r   r:   r   r|   r  r   r4   )r   ctxerrr>   s       r   r{  z-RawConfigParserTestCase.test_defaults_keywordu  s    ~.. 	.#NNQHN---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.mS#JKKK^^c3Z^00r$"67<cBBBBBs   A  AAN)
r!   r"   r#   r@   rR  r7   r]  rg  ru  r{  r   r   r   r  r  L  s`        /L
D 
D 
D9 9 99 9 9(C C C C Cr   r  c                       e Zd ZdZdZdZdS ),RawConfigParserTestCaseNonStandardDelimitersr  r  Nr  r   r   r   r  r    r  r   r  c                   .    e Zd Zej        ZdZdZdZd Z	dS )RawConfigParserTestSambaConf)r*   r)   z----)r  Fc                 ^   t          j        d          }|                                 }|                    |dgd          }|                     ||g           g d}|                     |                                |           |                     |                    dd          d           |                     |                    dd	          d
           |                     |                    dd          d           |                     |                    dd          d           d S )Nzcfgparser.2r  r   r   )globalhomesprinterszprint$zpdf-generatortmpAgustinr  	workgroupMDKGROUPzmax log size2   zhosts allowz127.r  zecho commandzcat %s; rm %s)r   r   r:   r"  r|   r{   r   r   )r   smbconfr>   r&  r{   s        r   test_readingz)RawConfigParserTestSambaConf.test_reading  s   "=11^^ww);<wwOOy111A A A111+66
CCC8^<<bAAA-88&AAA~66HHHHHr   N)
r!   r"   r#   r@   rR  r7   r/   r0   r1   r  r   r   r   r  r    sB        /L)%!I I I I Ir   r  c                   n    e Zd Zej        Z ej                    ZdZdZ	ddZ
d Zd Zd Zd Zd	 Zd
 ZdS ))ConfigParserTestCaseExtendedInterpolationcommonTNc                 l    |                      |          }|r||_        |                    |           |S r   )r:   r  r<   )r   r=   r,   r  r>   s        r   r?   z4ConfigParserTestCaseExtendedInterpolation.fromstring  s9    ^^H%% 	)(BN
v	r   c                    |                      t          j        d                                                    }| 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         d         d            ||d         d         d            ||d         d
         d            ||d         d         d           d S )Na  
            [common]
            favourite Beatle = Paul
            favourite color = green

            [tom]
            favourite band = ${favourite color} day
            favourite pope = John ${favourite Beatle} II
            sequel = ${favourite pope}I

            [ambv]
            favourite Beatle = George
            son of Edward VII = ${favourite Beatle} V
            son of George V = ${son of Edward VII}I

            [stanley]
            favourite Beatle = ${ambv:favourite Beatle}
            favourite pope = ${tom:favourite pope}
            favourite color = black
            favourite state of mind = paranoid
            favourite movie = soylent ${common:favourite color}
            favourite song = ${favourite color} sabbath - ${favourite state of mind}
        r  zfavourite BeatlePaulzfavourite colorgreentomzfavourite bandz	green dayzfavourite popezJohn Paul IIsequelzJohn Paul IIIambvGeorgezson of Edward VIIzGeorge Vzson of George Vz	George VIstanleyblackzfavourite state of mindparanoidzfavourite moviezsoylent greenzfavourite songzblack sabbath - paranoid)r?   r   r   r  r|   r  s      r   test_extended_interpolationzEConfigParserTestCaseExtendedInterpolation.test_extended_interpolation  s)   __X_ .  , UWW- 0 
2h<*+V444
2h<)*G444
2e9'(&111
2e9&'111
2e9%&444
2e9%&777
2e9X000
2f:()8444
2f:'('222
2f:)*J777
2f:'(+666
2i=+,h777
2i=*+W555
2i=23Z@@@
2i=*+_===
2i=)*N;;;
2i=)*%	' 	' 	' 	' 	'r   c                    |                      t          j        d                                                    }|                     t
          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t
          j                  5  |d         d          d d d            d S # 1 swxY w Y   d S )Nz
            [one for you]
            ping = ${one for me:pong}

            [one for me]
            pong = ${one for you:ping}

            [selfish]
            me = ${me}
        zone for youpingselfishme)r?   r   r   r  r   r@   rZ  r   s     r   test_endless_loopz;ConfigParserTestCaseExtendedInterpolation.test_endless_loop  s;   __X_ 	. 	 	 UWW	 	 |CDD 	& 	&}f%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&|CDD 	  	 yM$	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s$   A44A8;A8B::B>B>c                    |                      d          }|                     |d         d         d           |                     |d         d         d           |                     |d         d         d           t          j        }|                     |          5 }|d         d	          d d d            n# 1 swxY w Y   |                     |j        j        d
           |                     |j        j        d         d           d S )Nz
            [dollars]
            $var = $$value
            $var2 = ${$var}
            ${sick} = cannot interpolate me

            [interpolated]
            $other = ${dollars:$var}
            $trying = ${dollars:${sick}}
        dollarsz$varz$valueinterpolatedz$otherz${sick}zcannot interpolate mez$tryingzdollars:${sickr  z${dollars:${sick}})r?   r|   r@   ra  r   r   r`  r   )r   r>   exception_classr   s       r   test_strange_optionsz>ConfigParserTestCaseExtendedInterpolation.test_strange_options  s<   __ 	 	 	 	Iv.999N+H5x@@@Iy13JKKK&F// 	*2~y))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*/1ABBB*1-/CDDDDDs   B88B<?B<c                    t          j        d                                          }|                     |          }| j        } ||d         d         d            ||d         d         d            ||d         d         d            ||d         d         d	            ||d
         d         d            ||d
         d         d           d S )Naj  
            [common]
            optionlower = value
            OptionUpper = Value

            [Common]
            optionlower = a better ${common:optionlower}
            OptionUpper = A Better ${common:OptionUpper}

            [random]
            foolower = ${common:optionlower} redefined
            FooUpper = ${Common:OptionUpper} Redefined
        r  optionlowerr^   OptionUpperValueCommona better valueA Better Valuerandomfoolowervalue redefinedFooUpperA Better Value Redefined)r   r   r  r?   r|   r   r  r>   r   s       r   test_case_sensitivity_basiczEConfigParserTestCaseExtendedInterpolation.test_case_sensitivity_basic  s    o    UWW 	 __S!!
2h<&000
2h<&000
2h<&(8999
2h<&(8999
2h<
#%6777
2h<
#%?@@@@@r   c                 H   t          j        d                                          }|                     t          j                  5  |                     |          }d d d            n# 1 swxY w Y   |                     |d           }| j        } ||d         d         d            ||d         d         d            ||d	         d         d
            ||d	         d         d            ||d         d         d            ||d         d         d           d S )Na8  
            [common]
            option = value
            Option = Value

            [Common]
            option = a better ${common:option}
            Option = A Better ${common:Option}

            [random]
            foo = ${common:option} redefined
            Foo = ${Common:Option} Redefined
        c                     | S r   r   )r   s    r   r  z[ConfigParserTestCaseExtendedInterpolation.test_case_sensitivity_conflicts.<locals>.<lambda>#  s    # r   )r  r  r   r^   r   r  r  r  r	  r
  rT   r  r   r  )r   r   r  r   r@   r   r?   r|   r  s       r   test_case_sensitivity_conflictszIConfigParserTestCaseExtendedInterpolation.test_case_sensitivity_conflicts  sr   o    UWW 	 |@AA 	& 	&%%B	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& __Soo_>>
2h<!7+++
2h<!7+++
2h<!#3444
2h<!#3444
2h< 1222
2h< :;;;;;s   A((A,/A,c                 ^   |                      d          }|                     t          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t          j                  5  |d         d          d d d            n# 1 swxY w Y   |                     t
                    5  d|d         d	<   d d d            d S # 1 swxY w Y   d S )
Na   
            [interpolation fail]
            case1 = ${where's the brace
            case2 = ${does_not_exist}
            case3 = ${wrong_section:wrong_value}
            case4 = ${i:like:colon:characters}
            case5 = $100 for Fail No 5!
        zinterpolation failcase1case2case3case4case5zBLACK $ABBATHcase6)r?   r   r@   InterpolationSyntaxErrorra  r   r   s     r   test_other_errorsz;ConfigParserTestCaseExtendedInterpolation.test_other_errors,  s)   __    |DEE 	. 	.#$W--	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.|KLL 	. 	.#$W--	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.|KLL 	. 	.#$W--	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.|DEE 	. 	.#$W--	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.|DEE 	. 	.#$W--	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.z** 	@ 	@0?B#$W-	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@sk   AAA:BBB?CC!CDD#&D#	E$$E(+E(	F""F&)F&)NN)r!   r"   r#   r@   r|  r7   r  r5   r4   r3   r?   r  r  r  r  r  r  r   r   r   r  r    s        ,L6L688MOF   +' +' +'Z     "E E E*A A A0< < <6@ @ @ @ @r   r  c                       e Zd ZdZdS )ConfigParserTestCaseNoValueTN)r!   r"   r#   r-   r   r   r   r  r  D  s        NNNr   r  c                   8    e Zd Zej        ZdhZdhZdZd Z	d Z
dS )ConfigParserTestCaseTrickyFiler'   r*   Tc                    t          j        d          }|                                 }|                     t	          |                    |d                    d           |                     |                                g d           |                     |                    | j        dddi	          d
           | 	                    t                    5  |                    | j        ddddi           d d d            n# 1 swxY w Y   |                     t	          |                    dd                              d                    d           |                     t	          |                    dd                              d                    d           d}|                     |                    |d                     |                     |                    |d          d           |                     t	          |                    d                    d           | 	                    t           j                  5  |                    d           d d d            n# 1 swxY w Y   |                     |                    dd          d           |                     |                    dd          |                    dd                     |                     |                    dd          d           d S ) Nr   r   r   r   )strange
corruption&yeah, sections can be indented as wellanother one!no values heretricky interpolationmore interpolationgointerpolatez-1rn   T)rawro   r"  otherr     r#  r^   r  r$  zare they subsectionszlets use some Unicodeu	   片仮名r%  r   r&  r'  letszdo thisr(  zgo shopping)r   r   r:   r|   r~   r"  r{   r   r4   r   r   r   splitr   r   r   r@   ra  )r   r   r>   longnames       r   test_cfgparser_dot_3z3ConfigParserTestCaseTrickyFile.test_cfgparser_dot_3N  sS   !-00^^RWWVgW>>??CCC )? )? )? 	@ 	@ 	@ 	4#7)6(= # ? ?@B	D 	D 	Dz** 	2 	2IId*Dd)40  2 2 2	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	RVVIw77==dCCDDaHHHRVVL'::@@FFGGLLL;x1GHHIII*ABBKPPPRXXn5566:::|KLL 	' 	'HH%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 6??KKK 6?? 6==	? 	? 	? 4f==}MMMMMs$   !DD	D	I00I47I4c                     t          j        d          }|                                 }|                     t                    5  |                    |d           d d d            d S # 1 swxY w Y   d S )Nr   asciir   )r   r   r:   r   UnicodeDecodeErrorr"  )r   r   r>   s      r   test_unicode_failurez3ConfigParserTestCaseTrickyFile.test_unicode_failuren  s    !-00^^122 	. 	.GGFWG---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A((A,/A,N)r!   r"   r#   r@   r|  r7   r.   r/   r-   r2  r6  r   r   r   r   r   H  sR        ,LJuNN N N@. . . . .r   r   c                   (    e Zd ZdZdZd Zd Zd ZdS )Issue7005TestCasezrTest output when None is set() as a value and allow_no_value == False.

    http://bugs.python.org/issue7005

    z[section]
option = None

c                      |d          }|                     d           |                    ddd            t          j                    }|                    |           |                                S NF)r-   rX   r   )r   r   r   r   r  r  )r   r7   cpr   s       r   preparezIssue7005TestCase.prepare~  sd    \///
y!!!
y(D)))kmm
||~~r   c                     t          j        d          }|                    d           |                     t                    5  |                    ddd            d d d            d S # 1 swxY w Y   d S r:  )r@   r|  r   r   rk  r   )r   r;  s     r   test_none_as_value_stringifiedz0Issue7005TestCase.test_none_as_value_stringified  s    &e<<<
y!!!y)) 	. 	.FF9h---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A**A.1A.c                 z    |                      t          j                  }|                     || j                   d S r   )r<  r@   rR  r|   expected_output)r   r  s     r   "test_none_as_value_stringified_rawz4Issue7005TestCase.test_none_as_value_stringified_raw  s5    l:;;!566666r   N)r!   r"   r#   __doc__r@  r<  r>  rA  r   r   r   r8  r8  u  sR          5O  . . .7 7 7 7 7r   r8  c                       e Zd ZeZd ZdS )SortedTestCasec                     |                      d          }t          j                    }|                    |           |                     |                                d           d S )Nz [b]
o4=1
o3=2
o2=3
o1=4
[a]
k=v
z,[a]
k = v

[b]
o1 = 4
o2 = 3
o3 = 2
o4 = 1

)r?   r   r   r  r|   r  )r   r>   r  s      r   test_sortedzSortedTestCase.test_sorted  sl    __ % & & 
**&	' 	' 	' 	' 	'r   N)r!   r"   r#   r   r2   rF  r   r   r   rD  rD    s(        I' ' ' ' 'r   rD  c                   *    e Zd Zej        ZdZdZd ZdS )CompatibleTestCasez#;r)   c                 T   t          j        d          }|                     |          }|                     |                    dd          d           |                     |                    dd          d           |                     |                    dd          d           d S )	Nz        [Commented Bar]
        baz=qwe ; a comment
        foo: bar # not a comment!
        # but this is a comment
        ; another comment
        quirk: this;is not a comment
        ; a space must precede an inline comment
        rG   rT   zbar # not a comment!rR   rS   quirkzthis;is not a comment)r   r   r?   r|   r   r   s      r   test_comment_handlingz(CompatibleTestCase.test_comment_handling  s      )   __]++77/	1 	1 	177???990	2 	2 	2 	2 	2r   N)	r!   r"   r#   r@   rR  r7   r/   r0   rK  r   r   r   rH  rH    s7        /L!2 2 2 2 2r   rH  c                   $    e Zd Zej        ZddZdS )CopyTestCaseNc                 d   |                      |          }|                    |           |                                  }|                    |           |                                D ]G}|j        | j        k    r|| j                                                 D ]\  }}||         |k    r||= H|S r   )r:   r<   r   r   r   r4   r   )r   r=   r,   r>   cf_copyrX   r/  r^   s           r   r?   zCopyTestCase.fromstring  s    ^^H%%
v..""" ~~'' 	) 	)G|t333"$T%9":"@"@"B"B ) )7#u,,() r   r   )r!   r"   r#   r@   r|  r7   r?   r   r   r   rM  rM    s0        ,L     r   rM  c                       e Zd Zd Zd ZdS )FakeFilec                     t          j        d          }t          |d          5 }|                                | _        | j                                         d d d            d S # 1 swxY w Y   d S )Nr  r   r   )r   r   r   	readlineslinesreverse)r   	file_pathr   s      r   __init__zFakeFile.__init__  s    $]33	)g... 	!!DJJ   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   3A&&A*-A*c                 `    t          | j                  r| j                                        S dS r  )r~   rT  popr   s    r   r   zFakeFile.readline  s)    tz?? 	$:>>###rr   N)r!   r"   r#   rW  r   r   r   r   rQ  rQ    s2        ! ! !    r   rQ  c              #   n   K   |                                  }|r|V  |                                  }|dS dS )z+As advised in Doc/library/configparser.rst.N)r   )r   lines     r   readline_generatorr\    sO      ::<<D
 


zz||      r   c                   &    e Zd Zd Zd Zd Zd ZdS )ReadFileTestCasec                    t          j        d          g}	 |                    |d                             d                     n# t          $ r Y nw xY w|D ]}t          j                    }t          |d          5 }|                    |           d d d            n# 1 swxY w Y   | 	                    d|           | 	                    d|d                    | 
                    |d         d         d           d S )	Nr  r   utf8r   r   rH   rT   r   )r   r   ry   r)  UnicodeEncodeErrorr@   r|  r   r   assertInr|   )r   
file_pathsrV  r   r   s        r   	test_filezReadFileTestCase.test_file  sW   &}556
	jm226::;;;;! 	 	 	D	# 	A 	AI!.00Fi'222 $a  ###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $MM)V,,,MM%	!2333VI.u5x@@@@	A 	As#   .A 
AA>B  B$	'B$	c                 p   t          j        d                                                              d          }t	          j                    }|                    |           |                     d|           |                     d|d                    |                     |d         d         d           d S )Nz%
        [Foo Bar]
        foo=newbarr  rH   rT   r   )	r   r   r  r0  r@   r|  r   rb  r|   )r   rT  r   s      r   test_iterablezReadFileTestCase.test_iterable  s     !  uwwuuT{{ 	 *,,i(((eVI.///	*518<<<<<r   c                    t          j                    }|                     t                    5  |                    t                                 ddd           n# 1 swxY w Y   |                    t          t                                           |                     d|           |                     d|d                    |                     |d         d         d           dS )zIssue #11670.NrH   rT   r   )	r@   r|  r   rk  r   rQ  r\  rb  r|   r   r   s     r   test_readline_generatorz(ReadFileTestCase.test_readline_generator   s   *,,y)) 	) 	)XZZ(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)+HJJ77888i(((eVI.///	*518<<<<<s   "AA #A c                    t          j        d                                                              d          }t	          j                    }|                     t          j                  5 }|                    |d           ddd           n# 1 swxY w Y   | 	                    t          |j                  d           t          j        d                                                              d          }t	          j                    }|                     t          j                  5 }|                    |d           ddd           n# 1 swxY w Y   | 	                    t          |j                  d           t          j        d	                                                              d          }t	          j                    }|                     t          j                  5 }|                    |d           ddd           n# 1 swxY w Y   | 	                    t          |j                  d
           t          j        d                                                              d          }t	          j                    }|                     t          j                  5 }|                    |d           ddd           n# 1 swxY w Y   | 	                    t          |j                  d           dS )zIssue #18260.z"
        [badbad]
        [badbad]r  s   badbadr  NzGWhile reading from b'badbad' [line  2]: section 'badbad' already existsz5
        [badbad]
        bad = bad
        bad = badzWWhile reading from b'badbad' [line  3]: option 'bad' in section 'badbad' already existsz
        [badbad]
        = badz=Source contains parsing errors: b'badbad'
	[line  2]: '= bad'z"
        [badbad
        bad = badzDFile contains no section headers.
file: b'badbad', line: 1
'[badbad')r   r   r  r0  r@   r|  r   r   r   r|   r  r   r   r   r   )r   rT  r   dses       r   test_source_as_bytesz%ReadFileTestCase.test_source_as_bytes
  s    !  UWWUU4[[ 	 *,,|ABB 	6cU9555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6	
 	
 	

  !   eggeeDkk 	 *,,|@AA 	6SU9555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6&	
 	
 	

  !  %''%%++ 	 *,,|899 	6SU9555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6M	
 	
 	
  !  eggeeDkk 	 *,,|EFF 	6#U9555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6	
 	
 	
 	
 	
sH   ,BBB.EEE0HHH2KKKN)r!   r"   r#   rd  rf  ri  rl  r   r   r   r^  r^    sS        A A A= = == = =-
 -
 -
 -
 -
r   r^  c                   H    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S )CoverageOneHundredTestCasez"Covers edge cases in the codebase.c                    t          j        dd          }|                     |j        d           |                     |j        d           |                     |j        d            |                     |j        d            |                     |j        d           |                     t          |          d           d S )NrX   r   )rX   r   NNz3Option 'option' in section 'section' already exists)	r@   r   r|   rX   r   r  linenor   r  r   r   s     r   test_duplicate_option_errorz6CoverageOneHundredTestCase.test_duplicate_option_error=  s    1)XFF	222x000t,,,t,,,%FGGGU &6 	7 	7 	7 	7 	7r   c                     t          j        ddd          }|                     |j        d           |                     |j        d           |                     |j        d           d S )Nr   rX   rawval)r   rX   rt  )r@   rZ  r|   r   r   rX   rq  s     r   test_interpolation_depth_errorz9CoverageOneHundredTestCase.test_interpolation_depth_errorG  sj    4Xy5=? ?%DEEEx000	22222r   c                 t   |                      t                    5 }t          j                     d d d            n# 1 swxY w Y   |                     t          |j                  d           |                      t                    5 }t          j        dd           d d d            n# 1 swxY w Y   |                     t          |j                  d           t          j        d          }|                     |j        d           t          j	        d          5 }t          j
        d	t                     |                     |j        d           d|_        |                     |j        d           d d d            n# 1 swxY w Y   |D ]#}|                     |j        t          u            $d S )
Nz%Required argument `source' not given.r  filename)r  rw  z:Cannot specify both `filename' and `source'. Use `source'.rw  Trecordalways)r   r   r@   r   r|   r  r   r  r  r  r  r  rw  r   category)r   r   r   r  warnings        r   test_parsing_errorz-CoverageOneHundredTestCase.test_parsing_errorN  sr   z** 	(b%'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(R\** -5 	6 	6 	6z** 	Lb%X
KKKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	LR\** -J 	K 	K 	K)8<<<x000$D111 	7Q!(,>???U^X666'ENU\:666		7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7
  	D 	DGOOG,0BBCCCC	D 	Ds2   ;??B++B/2B/#AFFFc                 
   t          j                    }|                    d           |                     t           j                  5 }|d         d          d d d            n# 1 swxY w Y   |                     t          |j                  d           |                     t           j                  5 }|d         d          d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nz
            [section]
            invalid_percent = %
            invalid_reference = %(()
            invalid_variable = %(does_not_exist)s
        rX   invalid_percentz.'%' must be followed by '%' or '(', found: '%'invalid_referencez+bad interpolation variable reference '%(()')r@   r|  r<   r   r  r|   r  r   r   r   r   s      r   test_interpolation_validationz8CoverageOneHundredTestCase.test_interpolation_validationa  s   *,,  	 	 	 |DEE 	19/00	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1R\** -> 	? 	? 	?|DEE 	39122	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3R\** -? 	@ 	@ 	@ 	@ 	@s$   A##A'*A'5CCCc                    t          j        d          }t          j                    }t	          j        d          5 }t	          j        dt                     |                    |d           d d d            n# 1 swxY w Y   |D ]#}| 	                    |j
        t          u            $|                     t          |          d           |                     |d         d	         d
           d S )Nz2
        [section]
        option = value
        Try  r{  r   rx  r  rX   r   r^   )r   r   r@   r|  r  r  r  r  readfpr   r|  r|   r~   )r   r   r   r  r}  s        r   test_readfp_deprecationz2CoverageOneHundredTestCase.test_readfp_deprecationr  s+   k    *,,$D111 	4Q!(,>???MM#
M333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4  	D 	DGOOG,0BBCCCCVa(((	*84g>>>>>s   2A;;A?A?c                    t          j        d          5 }t          j        dt                     t	          j                    }d d d            n# 1 swxY w Y   |D ]#}|                     |j        t          u            $d S )NTry  r{  )r  r  r  r  r@   SafeConfigParserr   r|  )r   r  r   r}  s       r   !test_safeconfigparser_deprecationz<CoverageOneHundredTestCase.test_safeconfigparser_deprecation  s    $D111 	5Q!(,>???!244F	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5  	D 	DGOOG,0BBCCCC	D 	D   .AAAc                 J   t          j        d          5 }t          j        dt                     t	          j                     d d d            n# 1 swxY w Y   |                     t          |          d           |D ]"}|                     |j	        t                     #d S )NTry  r{  r   )
r  r  r  r  r@   r\  assertGreaterEqualr~   r   r|  )r   r  r}  s      r   $test_legacyinterpolation_deprecationz?CoverageOneHundredTestCase.test_legacyinterpolation_deprecation  s    $D111 	/Q!(,>???,...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	A*** 	@ 	@GMM'*,>????	@ 	@r  c                     t          j                    }|                    d           |                     t	          |d                   d           d S )Nz7
            [section]
            key = value
        rX   z<Section: section>)r@   r|  r<   r|   reprrh  s     r   test_sectionproxy_reprz1CoverageOneHundredTestCase.test_sectionproxy_repr  sY    *,,  	 	 	 	fY/002FGGGGGr   c                    t          j                    }dd l}|j        |j        d<   |                    d           |                     d|j                   |                     |                    dd          d           |                     |                    dd          d	           |                     |d                             d          d           |                     |d                             d          d	           |`| 	                    t                    5  |                    dd           d d d            n# 1 swxY w Y   |                     d|j                   |j        d= |                     d|j                   | 	                    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                    5  |d                             d           d d d            d S # 1 swxY w Y   d S )
Nr   decimalzS
            [s1]
            one = 1
            [s2]
            two = 2
        s1r  r   s2r  r  )r@   r|  r  Decimal
convertersr<   rb  r|   
getdecimalr   r   rH  )r   r   r  s      r   "test_inconsistent_converters_statez=CoverageOneHundredTestCase.test_inconsistent_converters_state  sJ   *,,'.)$  	 	 	 	i!2333**477;;;**477;;;0077;;;0077;;;~.. 	+ 	+dE***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+i!2333i(F$5666~.. 	+ 	+dE***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+~.. 	+ 	+4L##E***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+~.. 	+ 	+4L##E***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+sH   %EEE+GGG3HH"H I))I-0I-N)r!   r"   r#   rB  rr  ru  r~  r  r  r  r  r  r  r   r   r   rn  rn  :  s        ,,7 7 73 3 3D D D&@ @ @"? ? ?D D D@ @ @H H H+ + + + +r   rn  c                   T    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S )ExceptionPicklingTestCasezBTests for issue #13760: ConfigParser exceptions are not picklable.c                 `   dd l }t          j        d          }t          |j        dz             D ]}}|                    ||          }|                    |          }|                     |j        |j                   |                     t          |          t          |                     ~d S )Nr   r^   r   )
pickler@   Errorr   HIGHEST_PROTOCOLdumpsloadsr|   messager  r   r  e1protopicklede2s         r   
test_errorz$ExceptionPicklingTestCase.test_error  s    ((62Q677 	1 	1Ell2u--Gg&&BRZ444T"XXtBxx0000		1 	1r   c                    dd l }t          j        d          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     t          |          t          |                     d S )Nr   rX   r   )r  r@   r   r   r  r  r  r|   r  r   rX   r  r  s         r   test_nosectionerrorz-ExceptionPicklingTestCase.test_nosectionerror  s    (3362Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444T"XXtBxx0000	1 	1r   c                 "   dd l }t          j        dd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   r   rX   r   )r  r@   r   r   r  r  r  r|   r  r   rX   r   r  r  s         r   test_nooptionerrorz,ExceptionPicklingTestCase.test_nooptionerror  s    ')<<62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222T"XXtBxx0000	1 	1r   c                 d   dd l }t          j        ddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   rX   r  r   r   )r  r@   r   r   r  r  r  r|   r  r   rX   r  rp  r  r  s         r   test_duplicatesectionerrorz4ExceptionPicklingTestCase.test_duplicatesectionerror  s   /	8SII62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222RY	222T"XXtBxx0000	1 	1r   c                    dd l }t          j        dddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                      d S )Nr   rX   r   r  r   r   )r  r@   r   r   r  r  r  r|   r  r   rX   r   r  rp  r  r  s         r   test_duplicateoptionerrorz3ExceptionPicklingTestCase.test_duplicateoptionerror  s4   .y(H 62Q677 		1 		1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222RY	222RY	222T"XXtBxx0000		1 		1r   c                 $   dd l }t          j        ddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     t          |          t          |                     d S Nr   r   rX   msgr   )r  r@   InterpolationErrorr   r  r  r  r|   r  r   rX   r   r  r  s         r   test_interpolationerrorz1ExceptionPicklingTestCase.test_interpolationerror  s    ,Xy%HH62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222T"XXtBxx0000	1 	1r   c                 f   dd l }t          j        dddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   r   rX   rt  r`  r   )r  r@   ra  r   r  r  r  r|   r  r   rX   r   r`  r  r  s         r   $test_interpolationmissingoptionerrorz>ExceptionPicklingTestCase.test_interpolationmissingoptionerror  s   9(Ik# #62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222R\2<888T"XXtBxx0000	1 	1r   c                 $   dd l }t          j        ddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     t          |          t          |                     d S r  )r  r@   r  r   r  r  r  r|   r  r   rX   r   r  r  s         r   test_interpolationsyntaxerrorz7ExceptionPicklingTestCase.test_interpolationsyntaxerror  s    28YNN62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222T"XXtBxx0000	1 	1r   c                 $   dd l }t          j        ddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   r   rX   rt  r   )r  r@   rZ  r   r  r  r  r|   r  r   rX   r   r  r  s         r   test_interpolationdeptherrorz6ExceptionPicklingTestCase.test_interpolationdeptherror  s    1(I 62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RZ444RY	222T"XXtBxx0000	1 	1r   c                 <   dd l }t          j        d          }|                    dd           |                    dd           |                    dd           t	          |j        dz             D ]}|                    ||          }|                    |          }|                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                     t          j        d	
          }|                    dd           |                    dd           |                    dd           t	          |j        dz             D ]}|                    ||          }|                    |          }|                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   r  r   line1r  line2r  line3rw  rx  )r  r@   r   ry   r   r  r  r  r|   r  r   r  errorsr  r  s         r   test_parsingerrorz+ExceptionPicklingTestCase.test_parsingerror&  sP   &x00
		!W
		!W
		!W62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RY	222RY	222T"XXtBxx0000&
;;;
		!W
		!W
		!W62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RY	222RY	222T"XXtBxx0000	1 	1r   c                 d   dd l }t          j        ddd          }t          |j        dz             D ]}|                    ||          }|                    |          }|                     |j        |j                   |                     |j	        |j	                   |                     |j
        |j
                   |                     |j        |j                   |                     |j        |j                   |                     t          |          t          |                     d S )Nr   rw  r   r[  r   )r  r@   r   r   r  r  r  r|   r  r   r[  r  rp  r  r  s         r   test_missingsectionheadererrorz8ExceptionPicklingTestCase.test_missingsectionheadererrorA  s   3JVLL62Q677 	1 	1Ell2u--Gg&&BRZ444RWbg...RWbg...RY	222RY	222T"XXtBxx0000	1 	1r   N)r!   r"   r#   rB  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r  r    s        LL1 1 1	1 	1 	1
1 
1 
11 1 11 1 1
1 
1 
11 1 1
1 
1 
11 1 11 1 161 1 1 1 1r   r  c                       e Zd ZdZd ZdS )InlineCommentStrippingTestCasez}Tests for issue #14590: ConfigParser doesn't strip inline comment when
    delimiter occurs earlier without preceding space..c                    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 S )N)r)   r*   r  )r0   a  
        [section]
        k1 = v1;still v1
        k2 = v2 ;a comment
        k3 = v3 ; also a comment
        k4 = v4;still v4 ;a comment
        k5 = v5;still v5 ; also a comment
        k6 = v6;still v6; and still v6 ;a comment
        k7 = v7;still v7; and still v7 ; also a comment

        [multiprefix]
        k1 = v1;still v1 #a comment ; yeah, pretty much
        k2 = v2 // this already is a comment ; continued
        k3 = v3;#//still v3# and still v3 ; a comment
        rX   k1zv1;still v1k2v2k3v3k4zv4;still v4k5zv5;still v5k6zv6;still v6; and still v6k7zv7;still v7; and still v7multiprefixzv3;#//still v3# and still v3)r@   r|  r<   r|   )r   cfgr  s      r   test_strippingz-InlineCommentStrippingTestCase.test_strippingS  s\   ' A     	 	 	 	N4-0004$'''4$'''4-0004-0004"=>>>4"=>>>4-0004$'''4"@AAAAAr   N)r!   r"   r#   rB  r  r   r   r   r  r  O  s2        : :B B B B Br   r  c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )ExceptionContextTestCasezO Test that implementation details doesn't leak
    through raising exceptions. c                 4   t          j                    }|                    d           |                     t           j                  }|5  |                    dd           d d d            n# 1 swxY w Y   |                     |j        j        d           d S )Nz
        [Paths]
        home_dir: /Users
        my_dir: %(home_dir1)s/lumberjack
        my_pictures: %(my_dir)s/Pictures
        Pathsmy_dirT)	r@   r|  r<   r   ra  r   r   r   __suppress_context__r  s      r   test_get_basic_interpolationz5ExceptionContextTestCase.test_get_basic_interpolationw  s    *,,  	 	 	 |KLL 	* 	*JJw)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*bl7>>>>>s   
A--A14A1c                 Z   t          j        t          j                              }|                    d           |                     t           j                  }|5  |                    dd           d d d            n# 1 swxY w Y   |                     |j        j	        d           d S )Nr  z
        [Paths]
        home_dir: /Users
        my_dir: ${home_dir1}/lumberjack
        my_pictures: ${my_dir}/Pictures
        r  r  T)
r@   r|  r  r<   r   ra  r   r   r   r  r  s      r   test_get_extended_interpolationz8ExceptionContextTestCase.test_get_extended_interpolation  s    *$:<<> > >  	 	 	 |KLL 	* 	*JJw)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*bl7>>>>>s   B  BBc                 .   t          j                    }|                    d           |                     t           j                  5 }|                    d           d d d            n# 1 swxY w Y   |                     |j        j        d           d S )Nz2
        [Paths]
        home_dir: /Users
        rM  T)	r@   r|  r<   r   r   r   r   r   r  r  s      r   test_missing_optionsz-ExceptionContextTestCase.test_missing_options  s    *,,  	 	 	 |:;; 	#rNN6"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#bl7>>>>>s   A**A.1A.c                    t          j                    }|                     t           j                  5 }|                    ddd           d d d            n# 1 swxY w Y   |                     |j        j        d           d S )NSection1an_int15T)r@   r|  r   r   r   r   r   r  r   r   r   s      r   test_missing_sectionz-ExceptionContextTestCase.test_missing_section  s    *,,|:;; 	3rJJz8T222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3bl7>>>>>s   AAAc                    t          j                    }|                     t           j                  5 }|                    dd           d d d            n# 1 swxY w Y   |                     |j        j        d           d S )Nr  r  T)r@   r|  r   r   r   r   r   r  r  s      r   test_remove_optionz+ExceptionContextTestCase.test_remove_option  s    *,,|:;; 	7r  X666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7bl7>>>>>s   AAAN)	r!   r"   r#   rB  r  r  r  r  r  r   r   r   r  r  s  si        $ $? ? ?? ? ?? ? ?? ? ?? ? ? ? ?r   r  c                   8     e Zd ZdZej        Zd fd	Zd Z xZ	S )ConvertersTestCasez Introduced in 3.5, issue #18159.Nc                 b    t                                          |          }d |j        d<   |S )Nr   c                 >    d |                                  D             S )Nc                 ^    g | ]*}|                                 |                                 +S r   )r  )r   r   s     r   r   zBConvertersTestCase.newconfig.<locals>.<lambda>.<locals>.<listcomp>  s<     1? 1? 1?q45GGII1? 1? 1? 1?r   )r0  vs    r   r  z.ConvertersTestCase.newconfig.<locals>.<lambda>  s'     1? 1?AGGII 1? 1? 1? r   r}   )superr:   r  )r   r,   r9   	__class__s      r   r:   zConvertersTestCase.newconfig  s6    77$$h$77'? '?F#r   c                    |                                  }|                     d|j                   |                     d|j                   |                     |j        d                    |                     |j        d                    |                     |j        d                    |                     |j        d                    |                     t          |j                  d           |                     t                    5  d |j        d<   d d d            n# 1 swxY w Y   |                     t                    5  d |j        d <   d d d            n# 1 swxY w Y   |	                    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          g d           |                     |                    d
d          d           |                     |
                    d          d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          g d           |                     |                    d          d           |                     t                    5  |                    d
d           d d d            n# 1 swxY w Y   |                     t                    5  |                    d           d d d            n# 1 swxY w Y   dd l}|j        |j        d<   |                     d|j                   |                     |j        d                    |                     t          |j                  d           |                    d          }|                     |                    d
d          |           |                     |                    d          |           |j        d= |                     d|j                   |                     t          |j                  d           |                     t                    5  |                    d
d           d d d            n# 1 swxY w Y   |                     t                    5  |                    d           d d d            n# 1 swxY w Y   |                     t(                    5  |j        d= d d d            n# 1 swxY w Y   |                     t(                    5  |j        d= d d d            n# 1 swxY w Y   |                     t(                    5  |j        d = d d d            d S # 1 swxY w Y   d S )Nrf   r}   ra   rd   r.  c                     | S r   r   r  s    r   r  z4ConvertersTestCase.test_converters.<locals>.<lambda>  s    1 r   r  c                     | S r   r   r  s    r   r  z4ConvertersTestCase.test_converters.<locals>.<lambda>  s    Q r   z~
        [s]
        str = string
        int = 1
        float = 0.5
        list = a b c d e f g
        bool = yes
        r  r  r=   rt   z0.5za b c d e f gboolrr   r   g      ?)r   r   cdr   r   gTr   r  r   )r:   rb  r  r  assertIsNotNoner|   r~   r   r   r<   r   r   r   getlistr   r   r  r  r  rH  r   )r   r  r  r  dec0_5s        r   test_convertersz"ConvertersTestCase.test_converters  s   nni000fcn---#./000#.1222#.3444S^F3444S^,,a000z** 	- 	-!,CN2	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-z** 	/ 	/#.;CN4 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/  	 	 	 H58,,,53'''7U+++6O4446E***e,,h777e,,c222g..666f--???f--u555e,,h777C//333c733S999S&11 4C 4C 4C 	D 	D 	DV44d;;;ux000%!,,,G,,c2226** -< -< -< 	= 	= 	=f--t444~.. 	) 	)NN3(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)~.. 	" 	"LL!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"$+Oy!i000S^I6777S^,,a000''W55v>>>g..777N9%CN333S^,,a000~.. 	) 	)NN3(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)~.. 	" 	"LL!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"x(( 	* 	*y)	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*x(( 	# 	#r"	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#x(( 	% 	%t$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   D%%D),D)
E""E&)E&%SSS-TTTZ  ZZ%[[[,	\\\&	\;;\?\? 	]66]:=]:r   )
r!   r"   r#   rB  r@   r|  r7   r:   r  __classcell__r  s   @r   r  r    sa        **,L     D% D% D% D% D% D% D%r   r  c                   .    e Zd ZdZdZd Zd Zd Zd ZdS )!BlatantOverrideConvertersTestCasez}What if somebody overrode a getboolean()? We want to make sure that in
    this case the automatic converters do not kick in.z
        [one]
        one = false
        two = false
        three = long story short

        [two]
        one = false
        two = false
        three = four
    c                     t          j        dt          i          }|                    | j                   |                     |           |                     |j        d                    d S )Nr~   )r  )r@   r|  r~   r<   r   	_test_lenr  r  r   r  s     r   test_converters_at_initz9BlatantOverrideConvertersTestCase.test_converters_at_init  s`    'E3<@@@$$$sS^E233333r   c                     G d dt           j                  } |            }|                    | j                   |                     |           |                     |j        d                    |                     |                    dd                     |                     |                    dd                     | 	                    |                    dd                     | 	                    |                    dd                     |j
        |j        d<   | 	                    |                    dd                     | 	                    |                    dd                     | 	                    |                    dd                     | 	                    |                    dd                     d S )Nc                   P     e Zd ZdZddej        d fd
Zddej        ddZ xZS )OBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParserz0a historic borough in south central PennsylvaniaFNr,  ro   rm   c                `    ||k    rdS t                                          |||||          S )NTr  )r  r   )r   rX   r   r,  ro   rm   r  s         r   r   zZBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParser.getboolean  s?    f$$4ww))'6s3; * = = =r   c                B    |                      ||t          |||          S )Nr  )	_get_convr~   )r   rX   r   r,  ro   rm   s         r   getlenzVBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParser.getlen  s*    ~~gvs$/7 & 9 9 9r   )	r!   r"   r#   
gettysburgr@   rC   r   r  r  r  s   @r   StrangeConfigParserr    sx        KJ9>T!-!4= = = = = = = 6; , 39 9 9 9 9 9 9 9 9r   r
  r~   r  r  rf   )r@   r|  r<   r   r  r  r  r   r   r   _convert_to_boolean)r   r
  r  s      r   test_inheritancez2BlatantOverrideConvertersTestCase.test_inheritance  s   	9 	9 	9 	9 	9,"; 	9 	9 	9 "!##$$$s#./000ue44555ue44555u55666u55666$'$;y!u55666u55666u55666u5566666r   c                    |                      t          |j                  d           |                     d|j                   |                     d|j                   |                     d|j                   |                     |j        d                    |                     |j        d                    |                     |j        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	                  5  |                    d	d           d d d            n# 1 swxY w Y   |                      |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 )Nr.  rf   r~   tysburgra   rd   r  r   r  r     fourr   rl   )
r|   r~   r  rb  rH  r  r  r   r@   r   r  s     r   r  z+BlatantOverrideConvertersTestCase._test_len.  s   S^,,a000i000eS^,,,CN333#./000#.1222#.3444E5111555E5111555E733R888E5111555E5111555E733Q777E6A>>BBB|9:: 	& 	&JJuf%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&U**5111555U**5111555U**733R888U**5111555U**5111555U**733Q777U**6155q999U**622D99999s   !IIIc                 .   t          j                    d _        fd_                            | j                   |                     t          j                  d           | 	                    dj                   | 
                    dj                   |                     j        d                    |                     j        d                    |                     j        d                    |                                         dd                     |                                         d	d	                     |                                         dd	                     |                                         d	d                     j        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           |                     t                     5  |                     d                             d          d
           d d d            n# 1 swxY w Y   |                     t                     5  |                     d	                             d          d
           d d d            d S # 1 swxY w Y   d S )Nc                     dS )NTr   )rX   r   s     r   r  zLBlatantOverrideConvertersTestCase.test_instance_assignment.<locals>.<lambda>J  s     r   c                 :    t          |          |                   S r   )r~   )rX   r   r  s     r   r  zLBlatantOverrideConvertersTestCase.test_instance_assignment.<locals>.<lambda>K  s    SWf1E-F-F r   r  rf   r~   ra   rd   r  r  r   r  r  r.  )r@   r|  r   r  r<   r   r|   r~   r  rb  rH  r  r   r  r   r   r   r  s    @r   test_instance_assignmentz:BlatantOverrideConvertersTestCase.test_instance_assignmentH  s    '))55FFFF
$$$S^,,a000i000///#./000#.1222#.3444ue44555ue44555ue44555ue44555$'$;y!u55666u55666u55666u55666E5111555E5111555E733R888E5111555E5111555E733Q777 ~.. 	: 	:SZ..u55q999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:~.. 	: 	:SZ..u55q999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s$   ,0N((N,/N,0P

PPN)	r!   r"   r#   rB  r   r   r  r  r  r   r   r   r  r    sa        : :
F4 4 47 7 7:: : :4: : : : :r   r  c                       e Zd Zd ZdS )MiscTestCasec                 @    t          j        | t          dh           d S )Nr  )not_exported)r   check__all__r@   r   s    r   test__all__zMiscTestCase.test__all__k  s"    T<wiHHHHHHr   N)r!   r"   r#   r  r   r   r   r  r  j  s(        I I I I Ir   r  __main__)/collectionsr@   r   r  r#  r   unittestr  rM  r   test.supportr   UserDictr   r&   rE   TestCaserQ  rT  r~  r  r  r  r  r  r  r  r  r  r  r   r8  rD  rH  rM  rQ  r\  r^  rn  r  r  r  r  r  r  r!   mainr   r   r   <module>r"     s           				 				           " " " " " "    %   .       Bq8 q8 q8 q8 q8* q8 q8 q8h    ]H$5   
_L _L _L _L _L=(*; _L _L _LD!" !" !" !" !"-9J !" !" !"H@ @ @ @ @.B @ @ @0C C C C C83D C C C* * * * *0D * * *         4H      D D D D DmX-> D D D:0C 0C 0C 0C 0CmX-> 0C 0C 0Cf* * * * *3J * * *I I I I I#98;L I I I(h@ h@ h@ h@ h@x?P h@ h@ h@V    "6   *. *. *. *. *.%;X=N *. *. *.Z7 7 7 7 7) 7 7 7:' ' ' ' ', ' ' '.2 2 2 2 2/1B 2 2 2,    =("3   &
 
 
 
 
 
 
 
  P
 P
 P
 P
 P
x( P
 P
 P
fw+ w+ w+ w+ w+!2 w+ w+ w+tX1 X1 X1 X1 X1 1 X1 X1 X1v!B !B !B !B !BX%6 !B !B !BH3? 3? 3? 3? 3?x0 3? 3? 3?lO% O% O% O% O%(9 O% O% O%dl: l: l: l: l:(9 l: l: l:^I I I I I8$ I I I
 zHMOOOOO r   