Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_configparser.cpython-311.opt-2.pyc
�

�Ke�X���ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZGd�dej��Z
Gd�d��ZGd�d	e��ZGd
�deej��ZGd�d
eej��ZGd�deej��ZGd�de��ZGd�dej��ZGd�de��ZGd�de��ZGd�deej��ZGd�deej��ZGd�de��ZGd�deej��ZGd �d!eej��ZGd"�d#e��ZGd$�d%eej��ZGd&�d'ej��ZGd(�d)e��Z Gd*�d+eej��Z!Gd,�d-eej��Z"Gd.�d/��Z#d0�Z$Gd1�d2ej��Z%Gd3�d4ej��Z&Gd5�d6ej��Z'Gd7�d8ej��Z(Gd9�d:ej��Z)Gd;�d<eej��Z*Gd=�d>ej��Z+Gd?�d@ej��Z,e-dAkrej.��dSdS)B�N)�support)�	os_helperc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�ZeZ	dS)�
SortedDictc�N�t|j�����S�N)�sorted�data�items��selfs �@/usr/local/apps/python3/lib/python3.11/test/test_configparser.pyrzSortedDict.itemss���d�i�o�o�'�'�(�(�(�c�N�t|j�����Sr)r	r
�keysrs rrzSortedDict.keyss���d�i�n�n�&�&�'�'�'rc�>�d�|���D��S)Nc��g|]
}|d��S)��)�.0�is  r�
<listcomp>z%SortedDict.values.<locals>.<listcomp>s��+�+�+���!��+�+�+r)rrs r�valueszSortedDict.valuess��+�+�d�j�j�l�l�+�+�+�+rc�D�t|�����Sr)�iterrrs r�	iteritemszSortedDict.iteritemss���D�J�J�L�L�!�!�!rc�D�t|�����Sr)rrrs r�iterkeyszSortedDict.iterkeyss���D�I�I�K�K� � � rc�D�t|�����Sr)rrrs r�
itervalueszSortedDict.itervaluess���D�K�K�M�M�"�"�"rN)
�__name__�
__module__�__qualname__rrrrrr �__iter__rrrrrso������)�)�)�(�(�(�,�,�,�"�"�"�!�!�!�#�#�#��H�H�Hrrc�`�eZdZdZdZdZdZdZej	Z
dZejZ
ejZdd�Zdd�ZdS)	�CfgParserTestCaseClassF)�=�:)�;�#TNc��t||j|j|j|j|j|j|j|j|j	��
�
}|j
di|��}|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/r0r1r2r3r4r5�config_class)r
r,�	arguments�instances    r�	newconfigz CfgParserTestCaseClass.newconfig0sk�����.���!�2�$(�$@�"&�"<��n��;� �0��,�
�
�
�	�%�4�$�1�1�y�1�1���rc�Z�|�|��}|�|��|Sr)r:�read_string)r
�stringr,�cfs    r�
fromstringz!CfgParserTestCaseClass.fromstring@s*��
�^�^�H�
%�
%��
���v�����	rr)r!r"r#r-r.r/r0r1�configparser�
_default_dictr2r3�DEFAULTSECTr4�_UNSETr5r:r?rrrr&r&%su�������N��J�!��(�� ���*�I�
�F�"�.�O� �'�M����� �����rr&c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�
BasicTestCasec�(�gd�}|jr|�d��|���ddg}|���}|���|j}|||��|�d��}|���|||��d�|D��}|���|�|j��|���|||��|d���}tt|����}|||��|���}tt|����}|�t|��t|����|D]\}}|||j
���||���||j��||�dd��d	��||�d
d��d��||�dd��d��||�dd
��d��||�dd��d��||�dd
��d��||�dd��d��||�dd��d��||�
dd��d��||�dd��d��|�|�dd��d��||�dd��d��||�dd��d��||�dd��d ��||�d!d"��d#��|jr ||�dd$��d��||�ddd
�%��d	��||�dddd
i�&��d
��|�t$j��5|�d'd��ddd��n#1swxYwY|�t$j��5|�dd(��ddd��n#1swxYwY||�d'dd
�%��d
��||�dd(d
�%��d
��||�d
dd�%��d��||�d)dd�%��d��||�
ddd*�%��d��||�
dd+d*�%��d*��||�
dd+d,�%��d,��|�t$j��5|�
dd+��ddd��n#1swxYwY|�|�ddd-�%��d��|�|�dd.d-�%��d-��||�dd.d/�%��d/��|�t$j��5|�dd.��ddd��n#1swxYwY||�ddd0�%��d��||�dd1d2�%��d2��||�dd1d0�%��d0��|�t$j��5|�dd1��ddd��n#1swxYwY||�d3dd0�%��d0��|jrD||�dd$d�%��d��||�dd4d�%��d��||ddd	��||d
dd��|d}||j
d��|�|j|��|�t.��5d5|_
ddd��n#1swxYwY|�t.��5d6|_ddd��n#1swxYwY||dd��||d
d��||ddd��||dd
d��||ddd��||ddd��||d7dd8��|jr||dd$d��||d�dd
��d	��||d�dd
�%��d	��||d�ddd
i�&��d
��|�t0��5|d'dddd��n#1swxYwY|�t0��5|dd(ddd��n#1swxYwY|�t0��5|d'�dd
�%��ddd��n#1swxYwY||d�d(d
��d
��||d�d(d
�%��d
��||d�d(��d��||d
�dd��d��||d
�dd�%��d��|�t0��5|d)�dd��ddd��n#1swxYwY||d�
dd*��d��||d�
dd*�%��d��||d�
d+d*��d*��||d�
d+d*�%��d*��||d�
d+d,��d,��||d�
d+d,�%��d,��||d�
d+��d��|�|d�dd-��d��|�|d�dd-�%��d��|�|d�d.d-��d-��|�|d�d.d-�%��d-��||d�d.d/��d/��||d�d.d/�%��d/��||d�d.��d��||d�dd0��d��||d�dd0�%��d��||d�d1d2��d2��||d�d1d2�%��d2��||d�d1d0��d0��||d�d1d0�%��d0��||d�d1��d��|jr�||d�d$d��d��||d�d$d�%��d��||d�d4d��d��||d�d4d�%��d��d9||jd:<d;||jd<<|�|�d����|�|�dd����|�|�d����|�|�|j����|�|�dd��d=��|�|�dd��d>��|�|�dd��d?��|�|�dd:����|�|�dd:����|�|�|jd:����|�|�dd:����|�|�|jd:����|�t$j��5}|�d@d��ddd��n#1swxYwY|�|jjdA��||�d7d��d8��|d=|�d|v��|�t0��5|d=ddd��n#1swxYwY|�t@��5||j=ddd��n#1swxYwY|d
d=|�d|d
v��|�t0��5|d
d=ddd��n#1swxYwY|�d<|d
v��|�t0��5|d
d<=ddd��n#1swxYwY||jd<=|�d<|d
v��|�t0��5||jd<=ddd��n#1swxYwY|�t0��5|d@d=ddd��dS#1swxYwYdS)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�bar3rNc��g|]}|��Srr�r�sections  rrz,BasicTestCase.basic_test.<locals>.<listcomp>d���'�'�'��W�'�'�'rrHrT�bar1rM�bar2rUrRrSrG�bar4rL�key with spaces�value�another with spaces�splat!rO�int�*�42�float�)\��(�?z0.44�booleanF�123�strange but acceptablerP�forks�spoons�option-without-value��fallback��varszNo Such Foo Barzno-such-foozNo Such Spacey Bar�zno-such-int�18gz
no-such-floatz0.0Tzno-such-boolean�yesz
No Such Typeszno-such-option-without-valuezName is read-onlyzParser 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�assertEqualrr4r	�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�eqrrX�cms	         r�
basic_testzBasicTestCase.basic_testHs���

�

�

����	 �
�H�H�Y����	������
�_�-��
�K�K�M�M��	������
�
��
��1�a�����H�H�4�5�5��	������
��1�a����
(�'�B�'�'�'��	������	����%�&�&�&�	������
��1�a�����.�/�5�5�7�7���4��7�7�O�O��
��1�a�����H�H�J�J���4��7�7�O�O������Q����Q���(�(�(��	#�	#�M�D�'��B�t�W�\�"�"�"�"�
��2�;�;�=�=�"�T�1�2�3�3�3�	��2�6�6�)�U�#�#�V�,�,�,�
��2�6�6�,��&�&��/�/�/�
��2�6�6�1�5�9�9�6�B�B�B�
��2�6�6�1�5�9�9�5�A�A�A�
��2�6�6�/�5�)�)�6�2�2�2�
��2�6�6�/�5�)�)�5�1�1�1�
��2�6�6�(�-�.�.��8�8�8�
��2�6�6�(�1�2�2�H�=�=�=�
��2�9�9�W�e�$�$�b�)�)�)�
��2�6�6�'�5�!�!�4�(�(�(����r�{�{�7�G�<�<�d�C�C�C�
��2�6�6�'�7�#�#�V�,�,�,�
��2�=�=��)�,�,�e�4�4�4�
��2�6�6�'�5�!�!�#;�<�<�<�
��2�6�6�*�G�4�4�h�?�?�?���	@��B�r�v�v�i�!7�8�8�$�?�?�?�	��2�6�6�)�U�U�6�3�3�V�<�<�<�
��2�6�6�)�U�%���6�8�8�%�@�@�@�
�
�
�|�:�
;�
;�	-�	-��F�F�$�e�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�
�
�
�|�9�
:�
:�	-�	-��F�F�9�m�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�
��2�6�6�#�U�U�6�;�;�U�C�C�C�
��2�6�6�)�]�U�6�;�;�U�C�C�C�
��2�6�6�,���6�5�5�v�>�>�>�
��2�6�6�&���6�=�=�t�D�D�D�
��2�9�9�W�e�b�9�1�1�2�6�6�6�
��2�9�9�W�m�b�9�9�9�2�>�>�>�
��2�9�9�W�m�d�9�;�;�T�B�B�B�
�
�
�|�9�
:�
:�	.�	.��I�I�g�}�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.����r�{�{�7�G�47� +� 9� 9�:>�	@�	@�	@����r�{�{�7�O�47� +� 9� 9�:=�	?�	?�	?�
��2�;�;�w��%�;�@�@�%�H�H�H�
�
�
�|�9�
:�
:�	2�	2��K�K���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�=�=��"3�e�=�D�D��	�	�	�
��2�=�=��"3�d�=�C�C�T�J�J�J�
�
�
�|�9�
:�
:�	6�	6��M�M�'�#4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
��2�=�=��)�d�=�C�C�T�J�J�J���	.��B�r�v�v�i�!7�%�v�H�H�$�O�O�O��B�r�v�v�i�!?�$��&�&�',�
.�
.�
.�	��2�i�=����(�(�(�
��2�l��E�"�F�+�+�+��4�5��
��7�<�8�9�9�9��
�
�g�n�b�)�)�)�
�
�
�~�
.�
.�	/�	/�.�G�L�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�
�
�
�~�
.�
.�	3�	3�2�G�N�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
��7�5�>�6�"�"�"�
��7�5�>�5�!�!�!�
��2�o��u�%�v�.�.�.�
��2�o��u�%�u�-�-�-�
��2�h�<�)�*�G�4�4�4�
��2�h�<�-�.��9�9�9�
��2�k�?�5�!�E�	G�	G�	G���	<��B�r�)�}�3�4�d�;�;�;�
��2�i�=���U�E�*�*�F�3�3�3�
��2�i�=���U�U��3�3�V�<�<�<�
��2�i�=���U�%����8�8�%�@�@�@�
�
�
�x�
(�
(�	)�	)�� �!�%�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�
�
�x�
(�
(�	)�	)��y�M�-�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�
�
�x�
(�
(�	=�	=�� �!�%�%�e�e�%�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�
��2�i�=���]�E�2�2�E�:�:�:�
��2�i�=���]�U��;�;�U�C�C�C�
��2�i�=���]�+�+�T�2�2�2�
��2�l�����t�,�,�f�5�5�5�
��2�l�������5�5�v�>�>�>�
�
�
�x�
(�
(�	6�	6��#�$�(�(���5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
��2�g�;���e�R�(�(�"�-�-�-�
��2�g�;���e�b��1�1�2�6�6�6�
��2�g�;���m�R�0�0�"�5�5�5�
��2�g�;���m�b��9�9�2�>�>�>�
��2�g�;���m�T�2�2�D�9�9�9�
��2�g�;���m�d��;�;�T�B�B�B�
��2�g�;���m�,�,�d�3�3�3����r�'�{�3�3�G�S�A�A�4�H�H�H����r�'�{�3�3�G�=@� 4� B� B�CG�	I�	I�	I����r�'�{�3�3�O�S�I�I�3�O�O�O����r�'�{�3�3�O�=@� 4� B� B�CF�	H�	H�	H�
��2�g�;�����7�7��?�?�?�
��2�g�;����%��@�@�%�H�H�H�
��2�g�;����0�0�$�7�7�7�
��2�g�;�!�!�)�T�2�2�E�:�:�:�
��2�g�;�!�!�)�d�!�;�;�U�C�C�C�
��2�g�;�!�!�"3�U�;�;�U�C�C�C�
��2�g�;�!�!�"3�e�!�D�D��	�	�	�
��2�g�;�!�!�"3�T�:�:�D�A�A�A�
��2�g�;�!�!�"3�d�!�C�C�T�J�J�J�
��2�g�;�!�!�"3�4�4�d�;�;�;���	.��B�r�)�}� � �!7��?�?��F�F�F��B�r�)�}� � �!7�%� �H�H�$�O�O�O��B�r�)�}� � �!?��G�G��O�O�O��B�r�)�}� � �!?�$�!�&�&�',�
.�
.�
.�25��4�� ��.�14��4�� ��.�	
����)�)�(�3�3�4�4�4�������x�1B�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�
�
�
�|�:�
;�
;�	7�r����.��6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7������*�,@�A�A�A�
��2�6�6�+�u�%�%�E�	G�	G�	G�
�w�K�����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�,[�[�[�^�^�	^�8b�b�b�1c�c	�c	�h6�6h:�=h:�i6�6i:�=i:�k�k	�k	�)o�o�o�HAH'�H'AH+�H.AH+�J&AJ6�J6AJ:�J=AJ:�K	AK0�K0AK4�K7AK4�L;
AM�MAM�MAM�N
AN)�N)AN-�N0AN-�O9AP�PAP�PAP�P9
AQ�QAQ�QAQc��d�|j|j��}|jr|dz
}|�|��}|�|��|jr�|�tj	��5|�
tjd�|j������ddd��n#1swxYwY|�tj
��5|�
tjd�|j������ddd��dS#1swxYwYdS|�
tjd�|j������|�
tjd�|j������dS)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�r3r�r@�DuplicateOptionErrorr<�textwrap�dedent�DuplicateSectionError�r
�
config_stringr>s   r�
test_basiczBasicTestCase.test_basic(sL���<�F�4�?�D�1�2�2�=	�>��	��)�
�M��_�_�]�
+�
+����������;�	*��"�"�<�#D�E�E�
.�
.����x��0��F�4�?�+�+�	 -� -�.�.�.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��"�"�<�#E�F�F�
.�
.����x��0�
�F�4�?�+�+� -� -�.�.�.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.�
.�
.�
�N�N�8�?�,���t��'�'�	)�)�
*�
*�
*�
�N�N�8�?�,�
��t��'�'�)�)�
*�
*�
*�
*�
*s&�=AC	�	C
�C
�3AE�E�Ec
���ddiddiddd�ddd�ddiid	d
ddd
�ddd�ddddd�ddid�
}|jr|�dddii��|���}|�|��|�|��|jr�|�tj��5|�ddiddid���ddd��n#1swxYwY|�tj	��5|�dd d!d"�i��ddd��dS#1swxYwYdS|�ddiddid#���|�dd d!d"�i��dS)$NrTrZr[rUrS)rTrRr\rs�	Bulgarian�Default�English�Deutsch)zfoo[bg]rTzfoo[en]zfoo[de]r^r`)r]r_rbreFrh)rardrf�{rirj)
rHrMrNrGrJrKrIrLrOrPrQrk�key�key2�value2)rtrzDuplicate Options Herezwith a valuezwith another value)�option�OPTION)rX�SECTION)
r-�updater:�	read_dictr�r3r�r@r�r�)r
�configr>s   r�test_basic_from_dictz"BasicTestCase.test_basic_from_dictks����v���v����.�.�
����
���2�'� �$�$�	(�(�$+�'/���
�� �-�	����'�K(
�(
��R��	��M�M��*�D���
�
�
�
�^�^�
�
��
���V������������;�	��"�"�<�#E�F�F�
�
������)���)������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�"�"�<�#D�E�E�
�
����,�"0�"6�/�/�����
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
�
�L�L�!�7�+�"�H�-���
�
�
�
�L�L�(�,�2�+�+��
�
�
�
�
s$�-C�C�C�D(�(D,�/D,c�2�|���}|�d��|�d��|�d��|���}|���|j}||gd���|�ddd��||�d��dg��||�dd��dd��|�tj
��5|�ddd��ddd��n#1swxYwY|�|�dd����|�
|�dd����|�ddd	��d
D],}|�|�d|��d���-||�d��dg��||�d��dg��|�dd��||�d��g��|�d
�|jd����}||�d��dg��||�dd��d��|�d�|jd��ddi���}|�|�dd����dS)N�A�a�B)r�r�r�r^�b�@could not locate option, expecting case-insensitive option names�A-B�	A-B value��a-bzA-bza-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{rzr|�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�����K�K�M�M��	������
�
��
��1�o�o�o����
���s�C��!�!�!�
��2�:�:�c�?�?�S�E�"�"�"�
��2�6�6�#�s���W�M�	O�	O�	O�
�
�
�|�:�
;�
;�	&�	&��F�F�3��W�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	
����
�
�c�3�/�/�0�0�0�������s�C�0�0�1�1�1�
���s�E�;�'�'�'�/�	M�	M�C��O�O��
�
�c�3�'�'�K�
M�
M�
M�
M�	��2�:�:�c�?�?�U�G�$�$�$�
��2�:�:�c�?�?�S�E�"�"�"�
����c�"�"�"�
��2�:�:�c�?�?�B�����_�_�E�L�L����"�
$�
$�%�%��	��2�:�:�k�"�"�X�J�/�/�/�
��2�6�6�+�x�(�(�*C�D�D�D��_�_�0�06��t��q�7I�0J�0J�',�W�o��7�7��	
����
�
�i��7�7�8�8�8�8�8s�D,�,D0�3D0c	���|���}i|d<ddi|d<i|d<d�|D��}|���|j}|j}||t	dd|jdg����||d���dh��||dddd��|�t��5d|dd<ddd��n#1swxYwY|�	d|dv��d|dd	<d
D] }|�	||dvd���!||d���dh��||d���dh��|dd=||d���i��|�
d
�|jd����}||d���dh��||ddd��|�
d�|jd��ddi���}|�	d|dv��dS)Nr�r�r^r�c��g|]}|��SrrrWs  rrzFBasicTestCase.test_case_sensitivity_mapping_access.<locals>.<listcomp>�rYrr�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�rX)
r:rzr|�assertCountEqualr	r4rr�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�'�'�'��	������
�
���'��
��1�f�c�3�� 4�c�:�;�;�<�<�<�
��2�c�7�<�<�>�>�C�5�!�!�!�
��2�c�7�3�<��M�	O�	O�	O�
�
�
�x�
(�
(�	#�	#�"�B�s�G�C�L�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	
����r�#�w��'�'�'�$��3����/�	M�	M�C��O�O��r�#�w��K�
M�
M�
M�
M�	��2�c�7�<�<�>�>�E�7�#�#�#�
��2�c�7�<�<�>�>�C�5�!�!�!��s�G�C�L����3�������#�#�#��_�_�E�L�L����"�
$�
$�%�%��	��2�k�?���!�!�H�:�.�.�.�
��2�k�?�8�$�&?�@�@�@��_�_�0�06��t��q�7I�0J�0J�',�W�o��7�7��	
�����I��.�/�/�/�/�/s�C&�&C*�-C*c�"�|�ddi��}|�|�|jd��dd��|�ddi��}|�|�|jd��dd��dS)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���
�^�^�U�E�N�
+�
+������F�F�4�'��/�/��N�	P�	P�	P��^�^�U�E�N�
+�
+������F�F�4�'��/�/��J�	L�	L�	L�	L�	Lrc�n�|���}|�|tjd�|jd����|�|tjd�|jd����|�|tjd��}|�|jd��|j	s�|�|tjd��}|�|jd��tjd��}|jdd	krtj}|f}ntj}|dd
f}t|d���5}|�|||��}ddd��n#1swxYwY|�|j|��dSdS)
Nz[Foo]
{}val-without-opt-name
rr�No Section!
)�<???>rr�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_errorszBasicTestCase.test_parse_errorss���
�^�^�
�
������\�6�4�4:�F�4�?�1�;M�4N�4N�	P�	P�	P�	
����\�6�4�4:�F�4�?�1�;M�4N�4N�	P�	P�	P�
���R��!G�,�
.�
.�������!>�?�?�?��"�	/�� � ��\�%>� 9�;�;�A����Q�V�Z�0�0�0��%�m�4�4�F���q�!�S�(�(�$�1��"�9���$�>��"�A�M�O���f�w�/�/�/�
3�1��$�$�R���2�2��
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3����Q�V�X�.�.�.�.�.�	/�	/s�)F
�
F�Fc���t|d��r|}ntj|��}|�|��5}|�|��ddd��n#1swxYwY|jS)N�readline)�hasattr�io�StringIOr��	read_filer�)r
r>�exc�src�sior�s      rr�zBasicTestCase.parse_error/s����3�
�#�#�	#��C�C��+�c�"�"�C�
�
�
�s�
#�
#�	�r��L�L�����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��|�s�A�A#�&A#c�$�|���}|�|���gd��|�|�d��d��|�tj��5|�d��ddd��n#1swxYwY|�tj��5|�	ddd��ddd��n#1swxYwY|�
|tjdd��}|�|jd��|�d��|�
|tj
dd��}|�|jd��dS)	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_errorszBasicTestCase.test_query_errors8s���
�^�^�
�
�����������K�	M�	M�	M��������.�.�$�	%�	%�	%��
�
�|�:�
;�
;�	�	��J�J�u����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�|�:�
;�
;�	*�	*��F�F�5�%��)�)�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*��N�N�2�|�:�E�5�I�I��������*�*�*�
���u�����N�N�2�|�9�5�%�H�H��������0�0�0�0�0s$�B(�(B,�/B,�C6�6C:�=C:c��	|�||��|�d|j�d|j����dS#|$r}|cYd}~Sd}~wwxYw)Nzexpected exception type �.)r��failr"r#)r
r>r�rXr�r�s      rr�zBasicTestCase.get_errorIs���	<��F�F�7�F�#�#�#�
�I�I�I������)9�)9�;�
<�
<�
<�
<�
<���	�	�	��H�H�H�H�H�H�����	���s�?�A�A�A�Ac��|�d�|jd�����}tdd��D]}|�|�dd|z����|�|�dd|z����|�t|jdd	|z����dS)
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��BOOLTESTzt%dzf%dze%d)	r?r�r.�ranger�r�r�r�r�)r
r>�xs   r�test_booleanzBasicTestCase.test_booleanRs���
�_�_�
'�(.�v�T�_�Q�5G�v�'H�'H�!���$�q�!���	D�	D�A��O�O�B�M�M�*�e�a�i�@�@�A�A�A����R�]�]�:�u�q�y�A�A�B�B�B����j� �m�Z����
D�
D�
D�
D�	D�	Drc	�B�|���}|�d��|�tj��5}|�d��ddd��n#1swxYwY|j}|�t|��d��|�|jd��|j	�r\|�tj��5}|�
tjd�
|jd�����d���ddd��n#1swxYwY|j}|�t|��d	��|�|jd
��|�tj��5}|�ddd
d�i��ddd��n#1swxYwY|j}|�t|��d��|�|jd��dSdS)Nr�zSection 'Foo' already exists)r�NNz�                    [Foo]
                    will this be added{equals}True
                    [Bar]
                    what about this{equals}True
                    [Foo]
                    oops{equals}this won't
                rr��	<foo-bar>��sourcezFWhile reading from '<foo-bar>' [line  5]: section 'Foo' already exists)r�rr�r��valzis 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�r3r<r�r�r�r.r�r�)r
r>r�r�s    r�test_weird_errorszBasicTestCase.test_weird_errorsks���
�^�^�
�
��
���u����
�
�
�|�A�
B�
B�	"�b��N�N�5�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"��L������Q���!?�@�@�@������!4�5�5�5��;�	E��"�"�<�#E�F�F�
L�"����x��0��F�$�/�!�"4�F�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��V�V�&O�
P�
P�
P����Q�V�%<�=�=�=��"�"�<�#D�E�E�
P�����e�U�;L�%M�%M�N�O�O�O�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P����
P�
P�
P�
P���A����S��V�V�&M�
N�
N�
N����Q�V�%C�D�D�D�D�D�)	E�	Es7�	A+�+A/�2A/�"A	D7�7D;�>D;�&G
�
G�Gc���d�|j|jd|j���}|jr|dz
}|�|��}dD]�}t
j��}|�||���|jd}|rd�|��}d�||j�	��}|jr|d
z
}|�	|�
��|����dS)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)�commentr4z![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�r4z"[Valueless]
option-without-value

)r�r.r/r4r-r?r�r��writer|�getvalue)r
r�r>r
�output�	delimiter�
expect_strings       r�
test_writezBasicTestCase.test_write�s1��
������1F�q�1I�(,�(<��>�>�	���	��
%�
�M�
�_�_�]�
+�
+��'4�	?�	?�#��[�]�]�F��H�H�V�5L�H�M�M�M����*�I�&�
5�"�M�M�)�4�4�	�
��V�9�,0�,@��B�B�
�"�"�
����
�

���V�_�_�.�.�
�>�>�>�>�;	?�	?rc���|�d�|jd�����}Gd�dt��}|�ddd��|�dd|d����|�dd	d��|�dd	|d����|�ddd��|�dd	d��dS)
N�[sect]
option1{eq}foo
r�r�c��eZdZdS)�2BasicTestCase.test_set_string_types.<locals>.mystrN)r!r"r#rrr�mystrr�s�������Drr�sect�option1�splat�option2)r?r�r.rr�)r
r>rs   r�test_set_string_typesz#BasicTestCase.test_set_string_types�s���
�_�_�0�06��$�/�!�:L��0M�0M�O�O��	�	�	�	�	�C�	�	�	�
���v�y�'�*�*�*�
���v�y�%�%��.�.�1�1�1�
���v�y�'�*�*�*�
���v�y�%�%��.�.�1�1�1�
���v�y�'�*�*�*�
���v�y�'�*�*�*�*�*rc�2�|jddkr|�d��tjd��}|���}|�|dgd���}|�||g��|�|�dd	��d
��|���}|�|d���}|�||g��|�|�dd	��d
��|���}|�tj	|��d���}|�||g��|�|�dd	��d
��|���}|�tj	|��|gd���}|�|||g��|�|�dd	��d
��|���}|�dgd���}|�|g��|���}|�gd���}|�|g��dS)Nrr'�incompatible format�cfgparser.1�nonexistent-filer�r�rHrT�newbar)
r.�skipTestrr�r:�readr|r��pathlib�Path)r
�file1r>�parsed_filess    r�test_read_returns_file_listz)BasicTestCase.test_read_returns_file_list�sV���?�1���$�$��M�M�/�0�0�0�� ��/�/��
�^�^�
�
���w�w��'9�:�W�w�M�M�������w�/�/�/�������	�5�1�1�8�<�<�<�
�^�^�
�
���w�w�u�w�w�7�7�������w�/�/�/�������	�5�1�1�8�<�<�<�
�^�^�
�
���w�w�w�|�E�2�2�W�w�E�E�������w�/�/�/�������	�5�1�1�8�<�<�<�
�^�^�
�
���w�w���U� 3� 3�U�;�g�w�N�N�������u�~�6�6�6�������	�5�1�1�8�<�<�<�
�^�^�
�
���w�w� 2�3�g�w�F�F������r�*�*�*�
�^�^�
�
���w�w�r�G�w�4�4������r�*�*�*�*�*rc�,�|jddkr|�d��tjd�����}|���}|�|d���}|�||g��|���}|�dd���}|�|g��|���}|�|dgd���}|�||g��dS)Nrr'rrr�r�snonexistent-file)r.r!rr��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���$�$��M�M�/�0�0�0�"�+�M�:�:�A�A�C�C��
�^�^�
�
���w�w�/�'�w�B�B������(8�'9�:�:�:�
�^�^�
�
���w�w�2�W�w�E�E������r�*�*�*�
�^�^�
�
���w�w� 0�2E�F�QX�w�Y�Y������(8�'9�:�:�:�:�:rc�j�|�d�|jd�����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
rr�)r?r�r.rs r�get_interpolation_configz&BasicTestCase.get_interpolation_configs8�����
*�.+1�&����8J�&�*K�*K�1M�M�	Mrc��|�d�|j��ddi���}t|�dddi�����}|���|�||��|�tj	��5|�d��ddd��dS#1swxYwYdS)	Nz�
            [section]
            name {0[0]} %(value)s
            key{0[1]} |%(name)s|
            getdefault{0[1]} |%(default)s|
        �default�	<default>r�rXr^rnzno such section)
r?r�r.r}rrzr|r�r@r�)r
r�r>r�s    r�check_items_configz BasicTestCase.check_items_configs��
�_�_��

�F�4�?�#�#�y�+�.F��H�H��
����)�7�G�*<��=�=�>�>��	����������H�%�%�%�
�
�
�|�:�
;�
;�	(�	(��H�H�&�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�!C�C�Cc�
�|�d�|j��ddi���}|�|���dd��|�|���dd��|�|���dd��|�t��5|���ddd��dS#1swxYwYdS)	N��
            [section1]
            name1 {0[0]} value1
            [section2]
            name2 {0[0]} value2
            [section3]
            name3 {0[0]} value3
        r/r0r�r�section1�section2�section3)r?r�r.r|�popitemr�r�r�s  r�test_popitemzBasicTestCase.test_popitem)s&��
�_�_��
�F�4�?�#�#�y�+�.F��H�H��	
��������a��*�5�5�5���������a��*�5�5�5���������a��*�5�5�5�
�
�
�x�
(�
(�	�	��J�J�L�L�L�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�C8�8C<�?C<c��|�ddi��}|�|�|jd��dd��ddd�|d<|�|���dg��|�t|d�����hd	���|���|�t|�����t����|�t||j�����dh��dS)
NrTr�r�r��value1r�)rr�zing>rTrr)r:r|r�r4r{r�r�clearr�s  r�
test_clearzBasicTestCase.test_clear8s"��
�^�^�U�E�N�
+�
+������F�F�4�'��/�/��N�	P�	P�	P�"*�h�?�?��6�
�����������1�1�1�����R��Z�_�_�.�.�/�/�1N�1N�1N�O�O�O�
���
�
�
�����R�[�[�]�]�+�+�S�U�U�3�3�3�����R�� 4�5�:�:�<�<�=�=��w�G�G�G�G�Grc�*	�|�d�|j��ddi���}|�t	|d�����ddh��|�t	|d�����d	dh��|�t	|d
�����ddh��|�|ddd��|�|dd	d
��|�|d
dd��|�|���gd���ddi|d<|�t	|d�����ddh��|�|ddd��|�d	|d��|�|���gd���i|d
<|�t	|d
�����dh��|�d|d
��|�|���gd���||j||j<|�	t	||j�����t	����i||j<|�t	||j�����t	����|�t	|d�����dh��|�t	|d�����dh��|�t	|d
�����t	����|�|���gd���|d|d<|�t	|d�����dh��dS)Nr3�nameD�valueDr�r4�name1�namedr5�name2r6�name3r:r��value3)r4r5r6�name22�value22)
r?r�r.r|r�rr{�assertNotInr4�assertNotEqualr�s  r�test_setitemzBasicTestCase.test_setitemDs���
�_�_��
�F�4�?�#�#�w��.A��C�C��	
����R�
�^�0�0�2�2�3�3�g�w�5G�H�H�H�����R�
�^�0�0�2�2�3�3�g�w�5G�H�H�H�����R�
�^�0�0�2�2�3�3�g�w�5G�H�H�H�����J���0�(�;�;�;�����J���0�(�;�;�;�����J���0�(�;�;�;���������(L�(L�(L�M�M�M�"�I�.��:������R�
�^�0�0�2�2�3�3�h��5H�I�I�I�����J���1�9�=�=�=�����"�Z�.�1�1�1���������(L�(L�(L�M�M�M���:������R�
�^�0�0�2�2�3�3�g�Y�?�?�?�����"�Z�.�1�1�1���������(L�(L�(L�M�M�M�#%�d�&:�#;��4�� ����C��4�#7� 8� =� =� ?� ?�@�@�#�%�%�H�H�H�#%��4�� �����R�� 4�5�:�:�<�<�=�=�s�u�u�E�E�E�����R�
�^�0�0�2�2�3�3�g�Y�?�?�?�����R�
�^�0�0�2�2�3�3�h�Z�@�@�@�����R�
�^�0�0�2�2�3�3�S�U�U�;�;�;���������(L�(L�(L�M�M�M��J���:������R�
�^�0�0�2�2�3�3�h�Z�@�@�@�@�@rc��|jr|�d��tjd�|jd����}|���}|�tj	��5|�
|��ddd��n#1swxYwY|�|�dd��d��|�|ddd��dS)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_valuejs%����	P��M�M�N�O�O�O��/�#��v�d�o�a�0�1�1�
�
��
�^�^�
�
��
�
�
�|�8�
9�
9�	$�	$��N�N�7�#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�������	�6�2�2�F�;�;�;�����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�rrrr'r+r-r1r8r=rJrOrrrrErEFs�������[-�[-�[-�@A*�A*�A*�FJ�J�J�X'9�'9�'9�T&0�&0�&0�PL�L�L�/�/�/�8���1�1�1�"<�<�<�D�D�D�2E�E�E�>4?�4?�4?�l+�+�+�+�+�+�B;�;�;�$M�M�M�6(�(�(�
�
�
�
H�
H�
H�$A�$A�$A�L
8�
8�
8�
8�
8rrEc� �eZdZejZdZdS)�StrictTestCaseTN)r!r"r#r@�RawConfigParserr7r3rrrrQrQzs�������/�L�
�F�F�FrrQc�L�eZdZejZd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	S)
�ConfigParserTestCasec��|���}|j}||�dd��d��||�dd��d��||�dd��d��|�|tjdd��}|jtjkr|�|jd	��dSt|jtj
��r|�|jd	��dSdS)
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)rXr��5something %(with11)s lots of interpolation (11 steps))r-r|r�r�r@�InterpolationDepthErrorr5rCr��
isinstance�LegacyInterpolation)r
r>r�r�s    r�test_interpolationz'ConfigParserTestCase.test_interpolation�s<��
�
*�
*�
,�
,��
�
��
��2�6�6�%����!H�I�I�I�
��2�6�6�%�� � �;�	=�	=�	=�
��2�6�6�%��!�!�<�	>�	>�	>��N�N�2�|�C�U�G�T�T�����!4�4�4����Q�V�&I�
J�
J�
J�
J�
J�
��*�L�,L�
M�
M�	J����Q�V�&I�
J�
J�
J�
J�
J�	J�	Jrc���|���}|�|tjdd��}|�|jd��|�|jd��|�|jd��|jtj	kr|�|j
d��dSt|jtj��r|�|j
d��dSdS)N�Interpolation Errorr�	reference)rr_z
%(reference)sr`)
r-r�r@�InterpolationMissingOptionErrorr|r`rXr�r5rCr�r[r\r�s   r� test_interpolation_missing_valuez5ConfigParserTestCase.test_interpolation_missing_value�s��
�
*�
*�
,�
,���N�N�2�|�K�0�&�
:�
:�������k�2�2�2������$9�:�:�:������6�*�*�*����!4�4�4����Q�V�&B�
C�
C�
C�
C�
C�
��*�L�,L�
M�
M�	C����Q�V�&B�
C�
C�
C�
C�
C�	C�	Crc�4�|�gd���dS)N)�r/r0)�
getdefaultz|<default>|)r�z|value|)rr^�r1rs r�
test_itemszConfigParserTestCase.test_items�s3�����!4�!4�!4�	5�	5�	5�	5�	5rc��|�d�|jd�����}|�|�dd��d��|jtjkr,|�|�dd��d��dSt|jtj	��rK|�
t��5|�dd��ddd��dS#1swxYwYdSdS)	Nzc[section]
option1{eq}xxx
option2{eq}%(option1)s/xxx
ok{eq}%(option1)s/%%s
not_ok{eq}%(option2)s/%%srrrX�okzxxx/%s�not_okz
xxx/xxx/%s)r?r�r.r|r�r5r@rCr[r\r��	TypeErrorr�s  r�test_safe_interpolationz,ConfigParserTestCase.test_safe_interpolation�sK��
�_�_�9�:@��$(�O�A�$6�:@�:8�:8�	9�9��	
������	�4�0�0�(�;�;�;����!4�4�4����R�V�V�I�x�8�8�,�G�G�G�G�G�
��*�L�,L�
M�
M�	,��"�"�9�-�-�
,�
,����y�(�+�+�+�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,�
,�
,�	,�	,s�C=�=D�Dc�j�|�d�|jd�����}|�|�dd��d��|�t|jddd��|�t|jddd��|�t|jddd	��|�|�dd��d��|�dd
d��|�|�dd
��d��dS)
NrrrrrrT�%foo�foo%�f%oor�foo%%barzfoo%bar)r?r�r.r|r�r�r�r�r�s  r�#test_set_malformatted_interpolationz8ConfigParserTestCase.test_set_malformatted_interpolation�s��
�_�_�0�06��$�/�!�:L��0M�0M�O�O��	
�������	�2�2�E�:�:�:����*�b�f�f�i��H�H�H����*�b�f�f�i��H�H�H����*�b�f�f�i��H�H�H��������	�2�2�E�:�:�:�	���v�y�*�-�-�-��������	�2�2�I�>�>�>�>�>rc���|�d�|jd�����}|�t|jddd��|�t|jddd��|�t|jddt
����|�t|jddd��|�t|jddd��|�t|jddt
����|�t|jdd	d
��|�t|jd	��dS)Nrrrrrrg�?rr�zinvalid opt name!)r?r�r.r�rkr��objectr�r�s  r�test_set_nonstring_typesz-ConfigParserTestCase.test_set_nonstring_types�s/��
�_�_�0�06��$�/�!�:L��0M�0M�O�O��	
���)�R�V�V�Y��B�B�B����)�R�V�V�Y��D�D�D����)�R�V�V�Y����I�I�I����)�R�V�V�Y��B�B�B����)�R�V�V�Y��D�D�D����)�R�V�V�Y����I�I�I����)�R�V�V�S�:M�N�N�N����)�R�^�S�9�9�9�9�9rc�z�|���}|�t|j|j��dSr)r:r�r�r�r4r�s  r�test_add_section_defaultz-ConfigParserTestCase.test_add_section_default�s4��
�^�^�
�
�����*�b�n�d�6J�K�K�K�K�Krc���	|�ddi���}|�||jdd��|�||j�d��d��|�ddi���}|�||jdd	��|�||j�d��d��dS)
Nr�333333@r�rtz2.4r��������@r�z5.2)r:r|r4r�r�r�s  r�test_defaults_keywordz*ConfigParserTestCase.test_defaults_keyword�s���,�
�^�^�a��X�^�
.�
.������D�0�1�#�6��>�>�>����r�$�"6�7�@�@��E�E�s�K�K�K�
�^�^�c�3�Z�^�
0�
0������D�0�1�#�6��>�>�>����r�$�"6�7�@�@��E�E�s�K�K�K�K�KrN)r!r"r#r@�ConfigParserr7r]rbrgrlrrrurwr{rrrrTrTs��������,�L�J�J�J� C�C�C�5�5�5�
,�
,�
,�?�?�?� :�:�:�L�L�L�L�L�L�L�LrrTc�|�eZdZejZdZejd���	��Z
d�Zd�Zd�Z
d�ZdS)�#ConfigParserTestCaseNoInterpolationNz�
        [numbers]
        one = 1
        two = %(one)s * 2
        three = ${common:one} * 3

        [hexen]
        sixteen = ${numbers:two} * 8
    c��|�|ddd��|�|ddd��|�|ddd��|�|dd	d
��dS)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�Frc�d�|�|j��}|�|��dSr)r?�inir�r�s  r�test_no_interpolationz9ConfigParserTestCaseNoInterpolation.test_no_interpolation�s/��
�_�_�T�X�
&�
&�����b�!�!�!�!�!rc�~�|���}|�|�d����dS�N�)r:�assertIsNoner<r�s  r�test_empty_casez3ConfigParserTestCaseNoInterpolation.test_empty_case�s7��
�^�^�
�
�����"�.�.��,�,�-�-�-�-�-rc��Gd�dtj��}|��}|�|j��|�|��dS)Nc��eZdZdZdS)�bConfigParserTestCaseNoInterpolation.test_none_as_default_interpolation.<locals>.CustomConfigParserN)r!r"r#�_DEFAULT_INTERPOLATIONrrr�CustomConfigParserr��s������%)�"�"�"rr�)r@r|r<r�r�)r
r�r>s   r�"test_none_as_default_interpolationzFConfigParserTestCaseNoInterpolation.test_none_as_default_interpolation�sm��	*�	*�	*�	*�	*��!:�	*�	*�	*� �
�
!�
!��
���t�x� � � ����b�!�!�!�!�!r)r!r"r#r@r|r7r5r�r��stripr�r�r�r�r�rrrr~r~�s��������,�L��M�
�(�/��	�	�
�����G�G�G�"�"�"�.�.�.�"�"�"�"�"rr~c��eZdZejZej��5ejde	��ej
��Zddd��n#1swxYwYd�ZdS)�'ConfigParserTestCaseLegacyInterpolation�ignoreNc���|�d�|jd�����}|�|�dd��d��|�ddd��|�|�dd��d��|�ddd��|�|�dd��d��|�ddd	��|�|�dd��d	��|�dd
d��|�|�dd
��d��dS)NrrrrrrTrnrorprrq)r?r�r.r|r�r�r�s  rrrzKConfigParserTestCaseLegacyInterpolation.test_set_malformatted_interpolationsH��
�_�_�0�06��$�/�!�:L��0M�0M�O�O��	
�������	�2�2�E�:�:�:�
���v�y�&�)�)�)��������	�2�2�F�;�;�;�
���v�y�&�)�)�)��������	�2�2�F�;�;�;�
���v�y�&�)�)�)��������	�2�2�F�;�;�;�	���v�y�*�-�-�-��������	�2�2�J�?�?�?�?�?r)
r!r"r#r@r|r7�warnings�catch_warnings�simplefilter�DeprecationWarningr\r5rrrrrr�r�s��������,�L�	 ��	 �	"�	"�;�;����h�(:�;�;�;�8��8�:�:�
�;�;�;�;�;�;�;�;�;�;�;����;�;�;�;�@�@�@�@�@s�!A�A�Ar�c��eZdZd�ZdS)�,ConfigParserTestCaseInvalidInterpolationTypec��tjddfD]w}|�|���5|�t��5tj|���ddd��n#1swxYwYddd��n#1swxYwY�xdS)Nrbza string)r^�r5)r@�ExtendedInterpolation�subTestr�rkr|)r
r^s  r�*test_error_on_wrong_type_for_interpolationzWConfigParserTestCaseInvalidInterpolationType.test_error_on_wrong_type_for_interpolations2��"�8�2�
�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�	Cs5�A<�A%�A<�%A)�)A<�,A)�-A<�<B	�B	N)r!r"r#r�rrrr�r�s(������C�C�C�C�Crr�c��eZdZdZdZdZdS)�)ConfigParserTestCaseNonStandardDelimiters�z:=�$��//�"N�r!r"r#r.r/r0rrrr�r�%�!�������J�"��)���rr�c��eZdZdZdS)�-ConfigParserTestCaseNonStandardDefaultSection�generalN)r!r"r#r4rrrr�r�+s�������O�O�Orr�c�Z�eZdZejZd�dd��Zd�Zd�Z	d�Z
dS)�MultilineValuesTestCasezSI'm having spam spam spam spam spam spam spam beaked beans spam spam spam and spam!� �	
c��|���}td��D]m}d�|��}|�|��td��D]1}|�|d�|��|j���2�nt
tjdd���5}|�	|��ddd��dS#1swxYwYdS)N�dz	section{}�
z
lovely_spam{}�wr�r�)
r:r�r�r�r��wonderful_spamr�r�TESTFNr)r
r>r�s�jr�s      r�setUpzMultilineValuesTestCase.setUp5s��
�^�^�
�
���s���	J�	J�A��"�"�1�%�%�A��N�N�1�����2�Y�Y�
J�
J�����q�/�0�0��3�3�T�5H�I�I�I�I�
J�
�)�"�C�'�
:�
:�
:�	�a��H�H�Q�K�K�K�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�.C�C�Cc�B�tjtj��dSr)�os�unlinkrr�rs r�tearDownz MultilineValuesTestCase.tearDown?s��
�	�)�"�#�#�#�#�#rc�D�|���}ttjd���5}|�|��ddd��n#1swxYwY|�|�dd��|j�dd����dS)Nr�r��section8�lovely_spam4r��
)	r:r�rr�r�r|r�r��replace)r
�cf_from_filer�s   r� test_dominating_multiline_valuesz8MultilineValuesTestCase.test_dominating_multiline_valuesBs����~�~�'�'��
�)�"�W�
5�
5�
5�	&���"�"�1�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�����)�)�*�n�E�E��,�4�4�V�T�B�B�	D�	D�	D�	D�	Ds�A�A�AN)r!r"r#r@r|r7r�r�r�r�r�rrrr�r�/sg�������,�L�,�-4�W�S�&�-A�-A�����$�$�$�D�D�D�D�Drr�c�4�eZdZejZd�Zd�Zd�Zd�Z	dS)�RawConfigParserTestCasec�<�|���}|j}||�dd��d��||�dd��d��||�dd��d��||�dd��d	��dS)
Nr�r�z*something %(with1)s interpolation (1 step)rVz3something %(with9)s lots of interpolation (9 steps)rWz5something %(with10)s lots of interpolation (10 steps)rXrY)r-r|r��r
r>r�s   rr]z*RawConfigParserTestCase.test_interpolationOs���
�
*�
*�
,�
,��
�
��
��2�6�6�%����7�	9�	9�	9�
��2�6�6�%�� � �@�	B�	B�	B�
��2�6�6�%��!�!�B�	D�	D�	D�
��2�6�6�%��!�!�B�	D�	D�	D�	D�	Drc�4�|�gd���dS)N)rd)rez
|%(default)s|)r�z
|%(name)s|)rz	%(value)srfrs rrgz"RawConfigParserTestCase.test_items[s3�����!8�!8�!8�	9�	9�	9�	9�	9rc�V�|���}|�d��|�ddd��|�ddgd���|�ddddi��|�|�dd��d��|�|�dd��gd���|�|�dd��ddi��|�d	��|�d	d
d��|�|�d	d
��d��|jtjurKd�|_|�ddd��|�|�dd��d��dSdS)
Nz
non-stringrarr})rrr��r���
r6�pign��!	@r�zthis is sickTc��|Srr)r�s r�<lambda>zBRawConfigParserTestCase.test_set_nonstring_types.<locals>.<lambda>qs��q�r)	r:r�r�r|r��_dictr@rA�optionxformr�s  rruz0RawConfigParserTestCase.test_set_nonstring_typesas���
�^�^�
�
��
���|�$�$�$�
���|�U�A�&�&�&�
���|�V�%>�%>�%>�?�?�?�
���|�V�d�G�_�5�5�5��������e�4�4�a�8�8�8��������f�5�5�2�2�2�	4�	4�	4��������f�5�5��g��G�G�G�
���s����
���s�N�D�)�)�)��������^�4�4�d�;�;�;�
�8�|�1�1�1�)�[�B�N��F�F�<��A�&�&�&����R�V�V�L�!�4�4�a�8�8�8�8�8�2�1rc�n�	|�t��5}|�ddi���ddd��n#1swxYwY|j}|�t|��d��|�ddi���}|�||jdd��dS)Nrryr�z%'int' object has no attribute 'lower'r�rzr�)r�r�r:r�r|rr�r4)r
�ctx�errr>s    rr{z-RawConfigParserTestCase.test_defaults_keywordus���;�
�
�
�~�
.�
.�	.�#��N�N�Q��H�N�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.��m������S���#J�K�K�K�
�^�^�c�3�Z�^�
0�
0�����r�$�"6�7��<�c�B�B�B�B�Bs�A�A�AN)
r!r"r#r@rRr7r]rgrur{rrrr�r�Ls`�������/�L�
D�
D�
D�9�9�9�9�9�9�(C�C�C�C�Crr�c��eZdZdZdZdZdS)�,RawConfigParserTestCaseNonStandardDelimitersr�r�Nr�rrrr�r�r�rr�c�.�eZdZejZdZdZdZd�Z	dS)�RawConfigParserTestSambaConf)r*r)z----)r�Fc�^�tjd��}|���}|�|dgd���}|�||g��gd�}|�|���|��|�|�dd��d��|�|�dd	��d
��|�|�dd��d��|�|�d
d��d��dS)Nzcfgparser.2rr�r�)�global�homes�printerszprint$z
pdf-generator�tmp�Agustinr��	workgroup�MDKGROUPzmax log size�2zhosts allowz127.r�zecho commandz
cat %s; rm %s)rr�r:r"r|r{r�r�)r
�smbconfr>r&r{s     r�test_readingz)RawConfigParserTestSambaConf.test_reading�s���"�=�1�1��
�^�^�
�
���w�w��);�<�w�w�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�HrN)
r!r"r#r@rRr7r/r0r1r�rrrr�r��sB�������/�L�)��%��!��I�I�I�I�Irr�c�n�eZdZejZej��ZdZdZ	dd�Z
d�Zd�Zd�Z
d�Zd	�Zd
�ZdS)�)ConfigParserTestCaseExtendedInterpolation�commonTNc�l�|�|��}|r||_|�|��|Sr)r:r�r<)r
r=r,r�r>s     rr?z4ConfigParserTestCaseExtendedInterpolation.fromstring�s9��
�^�^�H�
%�
%���	)�(�B�N�
���v�����	rc��|�tjd�������}|j}||ddd��||ddd��||ddd��||ddd��||ddd	��||dd
d��||ddd
��||ddd��||ddd��||ddd��||ddd��||ddd��||ddd��||ddd��||ddd��||dd
d��||ddd��dS)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�zfavourite Beatle�Paulzfavourite color�green�tomzfavourite bandz	green dayzfavourite popezJohn Paul II�sequelz
John Paul III�ambv�Georgezson of Edward VIIzGeorge Vzson of George Vz	George VI�stanley�blackzfavourite state of mind�paranoidzfavourite moviez
soylent greenzfavourite songzblack sabbath - paranoid)r?r�r�r�r|r�s   r�test_extended_interpolationzEConfigParserTestCaseExtendedInterpolation.test_extended_interpolation�s)��
�_�_�X�_�.�
�
�,�U�W�W�-���0�
��
��2�h�<�*�+�V�4�4�4�
��2�h�<�)�*�G�4�4�4�
��2�e�9�'�(�&�1�1�1�
��2�e�9�&�'��1�1�1�
��2�e�9�%�&��4�4�4�
��2�e�9�%�&��7�7�7�
��2�e�9�X���0�0�0�
��2�f�:�(�)�8�4�4�4�
��2�f�:�'�(�'�2�2�2�
��2�f�:�)�*�J�7�7�7�
��2�f�:�'�(�+�6�6�6�
��2�i�=�+�,�h�7�7�7�
��2�i�=�*�+�W�5�5�5�
��2�i�=�2�3�Z�@�@�@�
��2�i�=�*�+�_�=�=�=�
��2�i�=�)�*�N�;�;�;�
��2�i�=�)�*�%�	'�	'�	'�	'�	'rc��|�tjd�������}|�t
j��5|ddddd��n#1swxYwY|�t
j��5|ddddd��dS#1swxYwYdS)Nz�
            [one for you]
            ping = ${one for me:pong}

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

            [selfish]
            me = ${me}
        zone for you�ping�selfish�me)r?r�r�r�r�r@rZr�s  r�test_endless_loopz;ConfigParserTestCaseExtendedInterpolation.test_endless_loop�s;��
�_�_�X�_�	.�	
�	
��U�W�W�	�	���
�
�|�C�
D�
D�	&�	&��}��f�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�
�
�
�|�C�
D�
D�	 �	 ��y�M�$���	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 s$�A4�4A8�;A8�B:�:B>�B>c��|�d��}|�|ddd��|�|ddd��|�|ddd��tj}|�|��5}|dd	ddd��n#1swxYwY|�|jjd
��|�|jjdd��dS)
Nz�
            [dollars]
            $var = $$value
            $var2 = ${$var}
            ${sick} = cannot interpolate me

            [interpolated]
            $other = ${dollars:$var}
            $trying = ${dollars:${sick}}
        �dollarsz$varz$value�interpolatedz$otherz${sick}zcannot interpolate mez$tryingzdollars:${sickr�z${dollars:${sick}})r?r|r@rar�r�r`r�)r
r>�exception_classr�s    r�test_strange_optionsz>ConfigParserTestCaseExtendedInterpolation.test_strange_options�s<��
�_�_�	�	
�	
��	
����I��v�.��9�9�9�����N�+�H�5�x�@�@�@�����I��y�1�3J�K�K�K�&�F��
�
�
��
/�
/�	*�2��~��y�)�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*������/�1A�B�B�B������*�1�-�/C�D�D�D�D�Ds�B8�8B<�?B<c��tjd�����}|�|��}|j}||ddd��||ddd��||ddd��||ddd	��||d
dd��||d
d
d��dS)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��
�
��U�W�W�	��_�_�S�
!�
!��
�
��
��2�h�<�
�&��0�0�0�
��2�h�<�
�&��0�0�0�
��2�h�<�
�&�(8�9�9�9�
��2�h�<�
�&�(8�9�9�9�
��2�h�<�
�#�%6�7�7�7�
��2�h�<�
�#�%?�@�@�@�@�@rc�H�tjd�����}|�tj��5|�|��}ddd��n#1swxYwY|�|d����}|j}||ddd��||ddd��||d	dd
��||d	dd��||dd
d��||ddd��dS)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��|Srr)r�s rr�z[ConfigParserTestCaseExtendedInterpolation.test_case_sensitivity_conflicts.<locals>.<lambda>#s��#�r)r�r�r�r^r�rrrr	r
rTrr�r)r�r�r�r�r@r�r?r|rs    r�test_case_sensitivity_conflictszIConfigParserTestCaseExtendedInterpolation.test_case_sensitivity_conflictssr���o��
�
��U�W�W�	��
�
�|�@�
A�
A�	&�	&�����%�%�B�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&��_�_�S�o�o�_�
>�
>��
�
��
��2�h�<��!�7�+�+�+�
��2�h�<��!�7�+�+�+�
��2�h�<��!�#3�4�4�4�
��2�h�<��!�#3�4�4�4�
��2�h�<��� 1�2�2�2�
��2�h�<��� :�;�;�;�;�;s�A(�(A,�/A,c�^�|�d��}|�tj��5|ddddd��n#1swxYwY|�tj��5|ddddd��n#1swxYwY|�tj��5|ddddd��n#1swxYwY|�tj��5|ddddd��n#1swxYwY|�tj��5|ddddd��n#1swxYwY|�t
��5d|dd	<ddd��dS#1swxYwYdS)
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!
        zinterpolation fail�case1�case2�case3�case4�case5z
BLACK $ABBATH�case6)r?r�r@�InterpolationSyntaxErrorrar�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|r7r�r5r4r3r?r�r�rrrrrrrr�r��s��������,�L�6�L�6�8�8�M��O�
�F�����+'�+'�+'�Z � � �"E�E�E�*A�A�A�0<�<�<�6@�@�@�@�@rr�c��eZdZdZdS)�ConfigParserTestCaseNoValueTN)r!r"r#r-rrrrrDs�������N�N�Nrrc�8�eZdZejZdhZdhZdZd�Z	d�Z
dS)�ConfigParserTestCaseTrickyFiler'r*Tc��tjd��}|���}|�t	|�|d�����d��|�|���gd���|�|�|jdddi�	��d
��|�	t��5|�|jddddi���ddd��n#1swxYwY|�t	|�d
d���d����d��|�t	|�dd���d����d��d}|�
|�|d����|�|�|d��d��|�t	|�d����d��|�	t j��5|�d��ddd��n#1swxYwY|�|�dd��d��|�|�dd��|�dd����|�|�dd��d��dS) 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)�rawror"�otherr��r#r^r�r$zare they subsectionszlets use some Unicodeu	片仮名r%r�r&r'�letszdo thisr(zgo shopping)rr�r:r|r~r"r{r�r4r�r�r��splitr�r�rr@ra)r
r�r>�longnames    r�test_cfgparser_dot_3z3ConfigParserTestCaseTrickyFile.test_cfgparser_dot_3NsS���!�-�0�0��
�^�^�
�
������R�W�W�V�g�W�>�>�?�?��C�C�C���������)?�)?�)?�	@�	@�	@�	
������4�#7��)6��(=�#�?�?�@B�	D�	D�	D�
�
�
�z�
*�
*�	2�	2��I�I�d�*�D�d�)�4�0�
�
2�
2�
2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	
����R�V�V�I�w�7�7�=�=�d�C�C�D�D�a�H�H�H�����R�V�V�L�'�:�:�@�@��F�F�G�G��L�L�L�;��������x�1G�H�H�I�I�I��������*A�B�B�K�P�P�P�����R�X�X�n�5�5�6�6��:�:�:�
�
�
�|�K�
L�
L�	'�	'��H�H�%�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'������� 6��?�?��K�K�K������� 6��?�?���� 6��=�=�	?�	?�	?������� 4�f�=�=�}�M�M�M�M�Ms$�!D�D	�D	�I0�0I4�7I4c���tjd��}|���}|�t��5|�|d���ddd��dS#1swxYwYdS)Nr��asciir�)rr�r:r��UnicodeDecodeErrorr")r
r�r>s   r�test_unicode_failurez3ConfigParserTestCaseTrickyFile.test_unicode_failurens����!�-�0�0��
�^�^�
�
��
�
�
�1�
2�
2�	.�	.��G�G�F�W�G�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�A(�(A,�/A,N)r!r"r#r@r|r7r.r/r-r2r6rrrr r HsR�������,�L���J��u���N�N�N�N�@.�.�.�.�.rr c�&�eZdZ	dZd�Zd�Zd�ZdS)�Issue7005TestCasez[section]
option = None

c���|d���}|�d��|�ddd��tj��}|�|��|���S�NF)r-rXr�)r�r�r�r�rr)r
r7�cpr�s    r�preparezIssue7005TestCase.prepare~sd��
�\��
/�
/�
/��
���y�!�!�!�
���y�(�D�)�)�)��k�m�m��
����
�
�
��|�|�~�~�rc���tjd���}|�d��|�t��5|�ddd��ddd��dS#1swxYwYdSr:)r@r|r�r�rkr�)r
r;s  r�test_none_as_value_stringifiedz0Issue7005TestCase.test_none_as_value_stringified�s���
�
&�e�
<�
<�
<��
���y�!�!�!�
�
�
�y�
)�
)�	.�	.��F�F�9�h��-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�A*�*A.�1A.c�z�|�tj��}|�||j��dSr)r<r@rRr|�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�6rN)r!r"r#r@r<r>rArrrr8r8usM�������5�O����.�.�.�7�7�7�7�7rr8c��eZdZeZd�ZdS)�SortedTestCasec���|�d��}tj��}|�|��|�|���d��dS)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�rr|r)r
r>r
s   r�test_sortedzSortedTestCase.test_sorted�sl��
�_�_�%�&�&�������
�������������*�*�&�	'�	'�	'�	'�	'rN)r!r"r#rr2rErrrrCrC�s(�������I�'�'�'�'�'rrCc�*�eZdZejZdZdZd�ZdS)�CompatibleTestCasez#;r)c�T�tjd��}|�|��}|�|�dd��d��|�|�dd��d��|�|�dd��d��dS)	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
        rGrTzbar # not a comment!rRrS�quirkzthis;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�	2rN)	r!r"r#r@rRr7r/r0rJrrrrGrG�s7�������/�L���!��2�2�2�2�2rrGc�$�eZdZejZdd�ZdS)�CopyTestCaseNc�d�|�|��}|�|��|���}|�|��|���D]G}|j|jkr�||j���D]\}}|||kr||=��H|Sr)r:r<r�rrr4r)r
r=r,r>�cf_copyrXr/r^s        rr?zCopyTestCase.fromstring�s���
�^�^�H�
%�
%��
���v�����.�.�"�"�����"�����~�~�'�'�	)�	)�G��|�t�3�3�3��"$�T�%9�":�"@�"@�"B�"B�
)�
)�����7�#�u�,�,���(��
)��rr)r!r"r#r@r|r7r?rrrrLrL�s0�������,�L�
�
�
�
�
�
rrLc��eZdZd�Zd�ZdS)�FakeFilec���tjd��}t|d���5}|���|_|j���ddd��dS#1swxYwYdS)Nrr�r�)rr�r��	readlines�lines�reverse)r
�	file_pathr�s   r�__init__zFakeFile.__init__�s����$�]�3�3�	�
�)�g�
.�
.�
.�	!�!������D�J��J��� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s�3A&�&A*�-A*c�`�t|j��r|j���SdSr�)r~rS�poprs rr�zFakeFile.readline�s)���t�z�?�?�	$��:�>�>�#�#�#��rrN)r!r"r#rVr�rrrrPrP�s2������!�!�!�����rrPc#�pK�	|���}|r|V�|���}|�dSdSr)r�)r��lines  r�readline_generatorr[�sR����5��:�:�<�<�D�
���
�
�
��z�z�|�|�������rc�&�eZdZd�Zd�Zd�Zd�ZdS)�ReadFileTestCasec��tjd��g}	|�|d�d����n#t$rYnwxYw|D]�}tj��}t|d���5}|�|��ddd��n#1swxYwY|�	d|��|�	d|d��|�
|ddd����dS)	Nrr�utf8r�r�rHrTr )rr�ryr)�UnicodeEncodeErrorr@r|r�r��assertInr|)r
�
file_pathsrUr�r�s     r�	test_filezReadFileTestCase.test_file�sW���&�}�5�5�6�
�	����j��m�2�2�6�:�:�;�;�;�;��!�	�	�	��D�	����#�	A�	A�I�!�.�0�0�F��i�'�2�2�2�
$�a�� � ��#�#�#�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$��M�M�)�V�,�,�,��M�M�%��	�!2�3�3�3����V�I�.�u�5�x�@�@�@�@�
	A�	As#�.A�
A�A�>B � B$	�'B$	c�p�tjd������d��}t	j��}|�|��|�d|��|�d|d��|�|ddd��dS)Nz%
        [Foo Bar]
        foo=newbarr�rHrTr )	r�r�r�r0r@r|r�rar|)r
rSr�s   r�
test_iterablezReadFileTestCase.test_iterable�s�����!����u�w�w�u�u�T�{�{�	��*�,�,����������
�
�i��(�(�(��
�
�e�V�I�.�/�/�/�����	�*�5�1�8�<�<�<�<�<rc���	tj��}|�t��5|�t����ddd��n#1swxYwY|�t
t������|�d|��|�d|d��|�|ddd��dS)NrHrTr )	r@r|r�rkr�rPr[rar|�r
r�s  r�test_readline_generatorz(ReadFileTestCase.test_readline_generators����*�,�,��
�
�
�y�
)�
)�	)�	)����X�Z�Z�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)����+�H�J�J�7�7�8�8�8��
�
�i��(�(�(��
�
�e�V�I�.�/�/�/�����	�*�5�1�8�<�<�<�<�<s�"A�A!�$A!c��	tjd������d��}t	j��}|�tj��5}|�|d���ddd��n#1swxYwY|�	t|j��d��tjd������d��}t	j��}|�tj��5}|�|d���ddd��n#1swxYwY|�	t|j��d��tjd������d��}t	j��}|�tj
��5}|�|d���ddd��n#1swxYwY|�	t|j��d	��tjd
������d��}t	j��}|�tj��5}|�|d���ddd��n#1swxYwY|�	t|j��d��dS)Nz"
        [badbad]
        [badbad]r�sbadbadrzGWhile 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�r0r@r|r�r�r�r|rr�r�r�r�)r
rSr��dses    r�test_source_as_bytesz%ReadFileTestCase.test_source_as_bytes
s������!����U�W�W�U�U�4�[�[�	��*�,�,��
�
�
�|�A�
B�
B�	6�c����U�9��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6������
���
�	
�	
�	
�
��!����e�g�g�e�e�D�k�k�	��*�,�,��
�
�
�|�@�
A�
A�	6�S����U�9��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6������
���
&�	
�	
�	
�
��!����%�'�'�%�%��+�+�	��*�,�,��
�
�
�|�8�
9�
9�	6�S����U�9��5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6������
���M�	
�	
�	
���!����e�g�g�e�e�D�k�k�	��*�,�,��
�
�
�|�E�
F�
F�	6�#����U�9��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�1H�H�H�3K�K�KN)r!r"r#rcrerhrkrrrr]r]�sS������A�A�A�=�=�=�=�=�=�-
�-
�-
�-
�-
rr]c�F�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�CoverageOneHundredTestCasec��tjdd��}|�|jd��|�|jd��|�|jd��|�|jd��|�|jd��|�t|��d��dS)NrXr�)rXr�NNz3Option 'option' in section 'section' already exists)	r@r�r|rXr�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�	7rc���tjddd��}|�|jd��|�|jd��|�|jd��dS)Nr�rX�rawval)r�rXrs)r@rZr|r�r�rXrps  r�test_interpolation_depth_errorz9CoverageOneHundredTestCase.test_interpolation_depth_errorGsj���4�X�y�5=�?�?�������%D�E�E�E������x�0�0�0������	�2�2�2�2�2rc�t�|�t��5}tj��ddd��n#1swxYwY|�t|j��d��|�t��5}tjdd���ddd��n#1swxYwY|�t|j��d��tjd���}|�|jd��tj	d���5}tj
d	t��|�|jd��d|_|�|jd��ddd��n#1swxYwY|D]#}|�
|jtu���$dS)
Nz%Required argument `source' not given.r�filename)rrvz:Cannot specify both `filename' and `source'. Use `source'.�rvT��record�always)r�r�r@r�r|rr�rr�r�r�r�rvr��category)r
r�r�r��warnings     r�test_parsing_errorz-CoverageOneHundredTestCase.test_parsing_errorNsr��
�
�
�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�	7�Q��!�(�,>�?�?�?����U�^�X�6�6�6�'�E�N����U�\�:�6�6�6�		7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�
�	D�	D�G��O�O�G�,�0B�B�C�C�C�C�	D�	Ds2�;�?�?�B+�+B/�2B/�#AF�F�Fc�
�tj��}|�d��|�tj��5}|ddddd��n#1swxYwY|�t
|j��d��|�tj��5}|ddddd��n#1swxYwY|�t
|j��d��dS)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�rr|rr��r
r�r�s   r�test_interpolation_validationz8CoverageOneHundredTestCase.test_interpolation_validationas����*�,�,������	
�	
�	
��
�
�|�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'�5C�C�Cc���tjd��}tj��}t	jd���5}t	jdt��|�|d���ddd��n#1swxYwY|D]#}|�	|j
tu���$|�t|��d��|�|dd	d
��dS)Nz2
        [section]
        option = value
        Trxrzr�rwr�rXr�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_deprecationrs+���k��
�
���*�,�,��
�
$�D�
1�
1�
1�	4�Q��!�(�,>�?�?�?��M�M�#�
�M�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��	D�	D�G��O�O�G�,�0B�B�C�C�C�C�����V���a�(�(�(�����	�*�8�4�g�>�>�>�>�>s�2A;�;A?�A?c��tjd���5}tjdt��t	j��}ddd��n#1swxYwY|D]#}|�|jtu���$dS)NTrxrz)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�	5�Q��!�(�,>�?�?�?�!�2�4�4�F�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5��	D�	D�G��O�O�G�,�0B�B�C�C�C�C�	D�	D��.A�A�Ac�J�tjd���5}tjdt��t	j��ddd��n#1swxYwY|�t|��d��|D]"}|�|j	t���#dS)NTrxrzr)
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��M�M�'�*�,>�?�?�?�?�	@�	@r�c��tj��}|�d��|�t	|d��d��dS)Nz7
            [section]
            key = value
        rXz<Section: section>)r@r|r<r|�reprrgs  r�test_sectionproxy_reprz1CoverageOneHundredTestCase.test_sectionproxy_repr�sY���*�,�,������	
�	
�	
�	
����f�Y�/�0�0�2F�G�G�G�G�Grc���tj��}ddl}|j|jd<|�d��|�d|j��|�|�dd��d��|�|�dd��d	��|�|d�d��d��|�|d�d��d	��|`|�	t��5|�dd��ddd��n#1swxYwY|�d|j��|jd=|�d|j��|�	t��5|�dd��ddd��n#1swxYwY|�	t��5|d�d��ddd��n#1swxYwY|�	t��5|d�d��ddd��dS#1swxYwYdS)
Nr�decimalzS
            [s1]
            one = 1
            [s2]
            two = 2
        �s1r�r�s2r�r�)r@r|r��Decimal�
convertersr<rar|�
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��;�;�;���
�
�
�~�
.�
.�	+�	+����d�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��
�
�i��!2�3�3�3���i�(�����F�$5�6�6�6�
�
�
�~�
.�
.�	+�	+����d�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�
�
�
�~�
.�
.�	+�	+��4�L�#�#�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�
�
�
�~�
.�
.�	+�	+��4�L�#�#�E�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+sH�%E�E�E�+G�G�G�3H�H�"H�I)�)I-�0I-N)r!r"r#rqrtr}r�r�r�r�r�r�rrrrmrm:s�������,�7�7�7�3�3�3�D�D�D�&@�@�@�"?�?�?�D�D�D�@�@�@�H�H�H�+�+�+�+�+rrmc�R�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dS)
�ExceptionPicklingTestCasec�`�ddl}tjd��}t|jdz��D]}}|�||��}|�|��}|�|j|j��|�t|��t|�����~dS)Nrr^r)
�pickler@�Errorr��HIGHEST_PROTOCOL�dumps�loadsr|�messager��r
r��e1�proto�pickled�e2s      r�
test_errorz$ExceptionPicklingTestCase.test_error�s����
�
�
�
�
��
(�
(���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����T�"�X�X�t�B�x�x�0�0�0�0�		1�	1rc���ddl}tjd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�t|��t|������dS)NrrXr)r�r@r�r�r�r�r�r|r�r�rXr�r�s      r�test_nosectionerrorz-ExceptionPicklingTestCase.test_nosectionerror�s����
�
�
�
�
(��
3�
3���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����T�"�X�X�t�B�x�x�0�0�0�0�
	1�	1rc�"�ddl}tjdd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�t|��t|������dS)Nrr�rXr)
r�r@r�r�r�r�r�r|r�r�rXr�r�r�s      r�test_nooptionerrorz,ExceptionPicklingTestCase.test_nooptionerror�s����
�
�
�
�
'��)�
<�
<���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�d�ddl}tjddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�t|��t|������dS)NrrXrr�r)r�r@r�r�r�r�r�r|r�r�rXrror�r�s      r�test_duplicatesectionerrorz4ExceptionPicklingTestCase.test_duplicatesectionerror�s���
�
�
�
�
/�	�8�S�
I�
I���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc��ddl}tjdddd��}t|jdz��D�]}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�|j
|j
��|�t|��t|������ dS)NrrXr�rr�r)r�r@r�r�r�r�r�r|r�r�rXr�rror�r�s      r�test_duplicateoptionerrorz3ExceptionPicklingTestCase.test_duplicateoptionerror�s4���
�
�
�
�
.�y�(�H������6�2�Q�6�7�7�		1�		1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����R�Y��	�2�2�2����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�		1�		1rc�$�ddl}tjddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�t|��t|������dS�Nrr�rX�msgr)
r�r@�InterpolationErrorr�r�r�r�r|r�r�rXr�r�r�s      r�test_interpolationerrorz1ExceptionPicklingTestCase.test_interpolationerror�s����
�
�
�
�
,�X�y�%�
H�
H���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�f�ddl}tjdddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�t|��t|������dS)Nrr�rXrsr`r)r�r@rar�r�r�r�r|r�r�rXr�r`r�r�s      r�$test_interpolationmissingoptionerrorz>ExceptionPicklingTestCase.test_interpolationmissingoptionerror�s���
�
�
�
�
9�(�I��k�#�#���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����R�\�2�<�8�8�8����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�$�ddl}tjddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�t|��t|������dSr�)
r�r@rr�r�r�r�r|r�r�rXr�r�r�s      r�test_interpolationsyntaxerrorz7ExceptionPicklingTestCase.test_interpolationsyntaxerror
s����
�
�
�
�
2�8�Y��
N�
N���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�$�ddl}tjddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�t|��t|������dS)Nrr�rXrsr)
r�r@rZr�r�r�r�r|r�r�rXr�r�r�s      r�test_interpolationdeptherrorz6ExceptionPicklingTestCase.test_interpolationdeptherrors����
�
�
�
�
1�(�I������6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Z���4�4�4����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�<�ddl}tjd��}|�dd��|�dd��|�dd��t	|jdz��D]�}|�||��}|�|��}|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�t|��t|������tjd	�
��}|�dd��|�dd��|�dd��t	|jdz��D]�}|�||��}|�|��}|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�t|��t|������dS)Nrrr�line1r��line2r��line3rvrw)r�r@r�ryr�r�r�r�r|r�r�r�errorsr�r�s      r�test_parsingerrorz+ExceptionPicklingTestCase.test_parsingerror&sP���
�
�
�
�
&�x�
0�
0��
�	�	�!�W����
�	�	�!�W����
�	�	�!�W�����6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Y��	�2�2�2����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�
�
&�
�
;�
;�
;��
�	�	�!�W����
�	�	�!�W����
�	�	�!�W�����6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�Y��	�2�2�2����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rc�d�ddl}tjddd��}t|jdz��D]�}|�||��}|�|��}|�|j|j��|�|j	|j	��|�|j
|j
��|�|j|j��|�|j|j��|�t|��t|������dS)Nrrvr�rZr)r�r@r�r�r�r�r�r|r�r�rZrror�r�s      r�test_missingsectionheadererrorz8ExceptionPicklingTestCase.test_missingsectionheadererrorAs���
�
�
�
�
3�J��V�
L�
L���6�2�Q�6�7�7�	1�	1�E��l�l�2�u�-�-�G����g�&�&�B����R�Z���4�4�4����R�W�b�g�.�.�.����R�W�b�g�.�.�.����R�Y��	�2�2�2����R�Y��	�2�2�2����T�"�X�X�t�B�x�x�0�0�0�0�	1�	1rN)r!r"r#r�r�r�r�r�r�r�r�r�r�r�rrrr�r��s�������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�1�61�1�1�1�1rr�c��eZdZ	d�ZdS)�InlineCommentStrippingTestCasec��tjd���}|�d��|d}|�|dd��|�|dd��|�|d	d
��|�|dd��|�|d
d��|�|dd��|�|dd��|d}|�|dd��|�|dd��|�|d	d��dS)N)r)r*r�)r0a�
        [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�k1zv1;still v1�k2�v2�k3�v3�k4zv4;still v4�k5zv5;still v5�k6zv6;still v6; and still v6�k7zv7;still v7; and still v7�multiprefixzv3;#//still v3# and still v3)r@r|r<r|)r
�cfgr�s   r�test_strippingz-InlineCommentStrippingTestCase.test_strippingSs\���'�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�ArN)r!r"r#r�rrrr�r�Os-������:�B�B�B�B�Brr�c�.�eZdZ	d�Zd�Zd�Zd�Zd�ZdS)�ExceptionContextTestCasec�4�tj��}|�d��|�tj��}|5|�dd��ddd��n#1swxYwY|�|jjd��dS)Nz�
        [Paths]
        home_dir: /Users
        my_dir: %(home_dir1)s/lumberjack
        my_pictures: %(my_dir)s/Pictures
        �Paths�my_dirT)	r@r|r<r�rar�r�r��__suppress_context__r�s   r�test_get_basic_interpolationz5ExceptionContextTestCase.test_get_basic_interpolationws����*�,�,������	
�	
�	
��
�
�|�K�
L�
L��
�	*�	*��J�J�w��)�)�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*��
�
�b�l�7��>�>�>�>�>s�
A-�-A1�4A1c�Z�tjtj�����}|�d��|�tj��}|5|�dd��ddd��n#1swxYwY|�|jj	d��dS)Nr�z�
        [Paths]
        home_dir: /Users
        my_dir: ${home_dir1}/lumberjack
        my_pictures: ${my_dir}/Pictures
        r�r�T)
r@r|r�r<r�rar�r�r�r�r�s   r�test_get_extended_interpolationz8ExceptionContextTestCase.test_get_extended_interpolation�s����*�$�:�<�<�>�>�>������	
�	
�	
��
�
�|�K�
L�
L��
�	*�	*��J�J�w��)�)�)�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*��
�
�b�l�7��>�>�>�>�>s�B�B�Bc�.�tj��}|�d��|�tj��5}|�d��ddd��n#1swxYwY|�|jjd��dS)Nz2
        [Paths]
        home_dir: /Users
        rMT)	r@r|r<r�r�r�r�r�r�r�s   r�test_missing_optionsz-ExceptionContextTestCase.test_missing_options�s����*�,�,������	
�	
�	
��
�
�|�:�
;�
;�	#�r��N�N�6�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#��
�
�b�l�7��>�>�>�>�>s�A*�*A.�1A.c��tj��}|�tj��5}|�ddd��ddd��n#1swxYwY|�|jjd��dS)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����*�,�,��
�
�
�|�:�
;�
;�	3�r��J�J�z�8�T�2�2�2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3��
�
�b�l�7��>�>�>�>�>s�A�A�Ac��tj��}|�tj��5}|�dd��ddd��n#1swxYwY|�|jjd��dS)Nr�r�T)r@r|r�r�r�r�r�r�r�s   r�test_remove_optionz+ExceptionContextTestCase.test_remove_option�s����*�,�,��
�
�
�|�:�
;�
;�	7�r�� � ��X�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7��
�
�b�l�7��>�>�>�>�>s�A�A�AN)r!r"r#r�r�r�r�r�rrrr�r�ssd������$�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?rr�c�6��eZdZ	ejZd�fd�	Zd�Z�xZS)�ConvertersTestCaseNc�b��t���|���}d�|jd<|S)Nr�c�>�d�|���D��S)Nc�^�g|]*}|����|�����+Sr)r�)rr�s  rrzBConvertersTestCase.newconfig.<locals>.<lambda>.<locals>.<listcomp>�s<��1?�1?�1?�q�45�G�G�I�I�1?������1?�1?�1?r)r0��vs rr�z.ConvertersTestCase.newconfig.<locals>.<lambda>�s'��1?�1?�A�G�G�I�I�1?�1?�1?�rr})�superr:r�)r
r,r9�	__class__s   �rr:zConvertersTestCase.newconfig�s6����7�7�$�$�h�$�7�7��'?�'?���F�#��rc��|���}|�d|j��|�d|j��|�|jd��|�|jd��|�|jd��|�|jd��|�t
|j��d��|�t��5d�|jd<ddd��n#1swxYwY|�t��5d�|jd<ddd��n#1swxYwY|�	d	��|d
}|�|dd��|�|dd
��|�|dd��|�|dd��|�|dd��|�|�
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��gd���|�|�d
d��d��|�|�
d��d��|�|�d��d��|�|�d��d��|�|�
d��gd���|�|�d��d��|�t��5|�d
d��ddd��n#1swxYwY|�t��5|�d��ddd��n#1swxYwYddl}|j|jd<|�d|j��|�|jd��|�t
|j��d��|�d��}|�|�d
d��|��|�|�d��|��|jd=|�d|j��|�t
|j��d��|�t��5|�d
d��ddd��n#1swxYwY|�t��5|�d��ddd��n#1swxYwY|�t(��5|jd=ddd��n#1swxYwY|�t(��5|jd=ddd��n#1swxYwY|�t(��5|jd=ddd��dS#1swxYwYdS)Nrfr}rardr.c��|Srrr�s rr�z4ConvertersTestCase.test_converters.<locals>.<lambda>�s��1�rr�c��|Srrr�s rr�z4ConvertersTestCase.test_converters.<locals>.<lambda>�s��Q�rz~
        [s]
        str = string
        int = 1
        float = 0.5
        list = a b c d e f g
        bool = yes
        r�rr=rtz0.5z
a b c d e f g�boolrrrg�?)r�r��c�dr�r��gTrr�r�)r:rar�r��assertIsNotNoner|r~r�r�r<r�r�r��getlistr�r�r�r�r�rHr�)r
r�r�r��dec0_5s     r�test_convertersz"ConvertersTestCase.test_converters�s����n�n�����
�
�i���0�0�0��
�
�f�c�n�-�-�-����#�.��/�0�0�0����#�.��1�2�2�2����#�.��3�4�4�4����S�^�F�3�4�4�4�����S�^�,�,�a�0�0�0�
�
�
�z�
*�
*�	-�	-�!,��C�N�2��	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�
�
�
�z�
*�
*�	/�	/�#.�;�C�N�4� �	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�����	
�	
�	
�
��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�������c�7�3�3�S�9�9�9�������S�&�1�1�4C�4C�4C�	D�	D�	D��������V�4�4�d�;�;�;�������u���x�0�0�0�������%���!�,�,�,�������G�,�,�c�2�2�2�������6�*�*�-<�-<�-<�	=�	=�	=�������f�-�-�t�4�4�4�
�
�
�~�
.�
.�	)�	)��N�N�3��(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�
�
�~�
.�
.�	"�	"�
�L�L��!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�����$+�O���y�!��
�
�i���0�0�0����S�^�I�6�7�7�7�����S�^�,�,�a�0�0�0�����'�'���������W�5�5�v�>�>�>�������g�.�.��7�7�7��N�9�%�����C�N�3�3�3�����S�^�,�,�a�0�0�0�
�
�
�~�
.�
.�	)�	)��N�N�3��(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�
�
�~�
.�
.�	"�	"�
�L�L��!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�
�
�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#r@r|r7r:r��
__classcell__�r�s@rr�r��s^�������*��,�L�������D%�D%�D%�D%�D%�D%�D%rr�c�,�eZdZ	dZd�Zd�Zd�Zd�ZdS)�!BlatantOverrideConvertersTestCasez�
        [one]
        one = false
        two = false
        three = long story short

        [two]
        one = false
        two = false
        three = four
    c���tjdti���}|�|j��|�|��|�|jd��dS)Nr~)r�)r@r|r~r<r��	_test_lenr�r��r
r�s  r�test_converters_at_initz9BlatantOverrideConvertersTestCase.test_converters_at_inits`���'�E�3�<�@�@�@�������$�$�$����s�������S�^�E�2�3�3�3�3�3rc��Gd�dtj��}|��}|�|j��|�|��|�|jd��|�|�dd����|�|�dd����|�	|�dd����|�	|�dd����|j
|jd<|�	|�dd����|�	|�dd����|�	|�dd����|�	|�dd����dS)Nc�P��eZdZdZddejd��fd�
Zddejd�d�Z�xZS)�OBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParserz0a historic borough in south central PennsylvaniaFN�r,rormc�`��||krdSt���|||||���S)NTr)r�r�)r
rXr�r,rormr�s      �rr�zZBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParser.getbooleans?����f�$�$��4��w�w�)�)�'�6�s��3;�*�=�=�=rc�B�|�||t|||���S)Nr)�	_get_convr~)r
rXr�r,rorms      r�getlenzVBlatantOverrideConvertersTestCase.test_inheritance.<locals>.StrangeConfigParser.getlens*���~�~�g�v�s��$�/7�&�9�9�9r)	r!r"r#�
gettysburgr@rCr�rr�r�s@r�StrangeConfigParserrsx�������K�J�9>�T�!-�!4�
=�
=�
=�
=�
=�
=�
=�6;�� ,� 3�
9�
9�
9�
9�
9�
9�
9�
9�
9rr	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_inheritances���	9�	9�	9�	9�	9�,�";�	9�	9�	9�"�!�#�#�������$�$�$����s�������#�.��/�0�0�0�������u�e�4�4�5�5�5�������u�e�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�6rc��|�t|j��d��|�d|j��|�d|j��|�d|j��|�|jd��|�|jd��|�|jd��|�|�dd��d��|�|�dd	��d��|�|�dd
��d��|�|�d	d��d��|�|�d	d	��d��|�|�d	d
��d��|�|�d	dd
���d
��|�tj	��5|�d	d��ddd��n#1swxYwY|�|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��dS)Nr.rfr~�tysburgrardr�r�r�r���fourrrl)
r|r~r�rarHr�rr�r@r�r�s  rr�z+BlatantOverrideConvertersTestCase._test_len.s������S�^�,�,�a�0�0�0��
�
�i���0�0�0��
�
�e�S�^�,�,�,�����C�N�3�3�3����#�.��/�0�0�0����#�.��1�2�2�2����#�.��3�4�4�4�������E�5�1�1�1�5�5�5�������E�5�1�1�1�5�5�5�������E�7�3�3�R�8�8�8�������E�5�1�1�1�5�5�5�������E�5�1�1�1�5�5�5�������E�7�3�3�Q�7�7�7�������E�6�A��>�>��B�B�B�
�
�
�|�9�
:�
:�	&�	&��J�J�u�f�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�����U��*�*�5�1�1�1�5�5�5�����U��*�*�5�1�1�1�5�5�5�����U��*�*�7�3�3�R�8�8�8�����U��*�*�5�1�1�1�5�5�5�����U��*�*�5�1�1�1�5�5�5�����U��*�*�7�3�3�Q�7�7�7�����U��*�*�6�1�5�5�q�9�9�9�����U��*�*�6�2�2�D�9�9�9�9�9s�!I�I�Ic�.��tj���d��_�fd��_��|j��|�t�j��d��|�	d�j��|�
d�j��|��jd��|��jd��|��jd��|���dd����|���d	d	����|���dd	����|���d	d�����j
�jd<|���dd����|���d	d	����|���dd	����|���d	d����|���dd��d
��|���dd	��d
��|���dd��d��|���d	d��d
��|���d	d	��d
��|���d	d��d
��|�t ��5|��d�d��d
��ddd��n#1swxYwY|�t ��5|��d	�d��d
��ddd��dS#1swxYwYdS)Nc��dS)NTr)rXr�s  rr�zLBlatantOverrideConvertersTestCase.test_instance_assignment.<locals>.<lambda>Js���rc�:��t�||��Sr)r~)rXr�r�s  �rr�zLBlatantOverrideConvertersTestCase.test_instance_assignment.<locals>.<lambda>Ks���S��W��f�1E�-F�-F�rr�rfr~rardr�r�r�r�rr.)r@r|r�rr<r�r|r~r�rarHr�r�r
r�r�r�r�s @r�test_instance_assignmentz:BlatantOverrideConvertersTestCase.test_instance_assignmentHs����'�)�)��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�������u�e�4�4�5�5�5�������u�e�4�4�5�5�5�������u�e�4�4�5�5�5�������u�e�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�������E�5�1�1�1�5�5�5�������E�5�1�1�1�5�5�5�������E�7�3�3�R�8�8�8�������E�5�1�1�1�5�5�5�������E�5�1�1�1�5�5�5�������E�7�3�3�Q�7�7�7��
�
�~�
.�
.�	:�	:����S��Z�.�.�u�5�5�q�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:�
�
�
�~�
.�
.�	:�	:����S��Z�.�.�u�5�5�q�9�9�9�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:�	:�	:s$�,0N(�(N,�/N,�
0P
�
P�PN)r!r"r#r�r�rr�rrrrr�r��s\������:�
�F�4�4�4�7�7�7�::�:�:�4:�:�:�:�:rr�c��eZdZd�ZdS)�MiscTestCasec�@�tj|tdh���dS)Nr�)�not_exported)r�check__all__r@rs r�test__all__zMiscTestCase.test__all__ks"����T�<�w�i�H�H�H�H�H�HrN)r!r"r#rrrrrrjs(������I�I�I�I�Irr�__main__)/�collectionsr@r�r�r#r��unittestr�rMr�test.supportr�UserDictrr&rE�TestCaserQrTr~r�r�r�r�r�r�r�r�r�rr r8rCrGrLrPr[r]rmr�r�r�r�r�rr!�mainrrr�<module>r!s�����������	�	�	�	�	�	�	�	�����������������������"�"�"�"�"�"�������%����.��������Bq8�q8�q8�q8�q8�*�q8�q8�q8�h�����]�H�$5����
_L�_L�_L�_L�_L�=�(�*;�_L�_L�_L�D!"�!"�!"�!"�!"�-��9J�!"�!"�!"�H@�@�@�@�@�.B�@�@�@�0C�C�C�C�C�8�3D�C�C�C�*�*�*�*�*�0D�*�*�*� � � � � �4H� � � �D�D�D�D�D�m�X�->�D�D�D�:0C�0C�0C�0C�0C�m�X�->�0C�0C�0C�f*�*�*�*�*�3J�*�*�*�I�I�I�I�I�#9�8�;L�I�I�I�(h@�h@�h@�h@�h@�
�x�?P�h@�h@�h@�V�����"6����*.�*.�*.�*.�*.�%;�X�=N�*.�*.�*.�Z7�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
�fw+�w+�w+�w+�w+��!2�w+�w+�w+�tX1�X1�X1�X1�X1�� 1�X1�X1�X1�v!B�!B�!B�!B�!B�X�%6�!B�!B�!B�H3?�3?�3?�3?�3?�x�0�3?�3?�3?�lO%�O%�O%�O%�O%���(9�O%�O%�O%�dl:�l:�l:�l:�l:��(9�l:�l:�l:�^I�I�I�I�I�8�$�I�I�I�
�z����H�M�O�O�O�O�O��r