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

�Ke�-��V�ddlZddlZddlmZGd�de��ZGd�de��ZGd�de��ZGd	�d
e��ZGd�de	��Z
Gd
�de
��ZGd�de	��ZGd�de��Z
Gd�de
��ZGd�de	��ZGd�dej��ZGd�de��ZGd�de��ZGd�dej��ZGd�d ��ZGd!�d"eej��ZGd#�d$eej��Zed%krej��dSdS)&�N)�supportc��eZdZdS)�PropertyBaseN��__name__�
__module__�__qualname__���</usr/local/apps/python3/lib/python3.11/test/test_property.pyrr��������Drrc��eZdZdS)�PropertyGetNrr
rrrrr
rrc��eZdZdS)�PropertySetNrr
rrrrr
rrc��eZdZdS)�PropertyDelNrr
rrrrr
rrc�j�eZdZd�Zed���Zejd���Zejd���ZdS)�	BaseClassc��d|_dS�N���_spam��selfs r�__init__zBaseClass.__init__s
����
�
�
rc��	|jS�Nrrs r�spamzBaseClass.spams
����z�rc��||_dSrr�r�values  rr zBaseClass.spams
����
�
�
rc�
�|`dSrrrs rr zBaseClass.spam!s���J�J�JrN)rrr	r�propertyr �setter�deleterr
rrrrsx�������������X��
�[����[��
�\����\���rrc�x�eZdZejjd���Zejd���Zejd���ZdS)�SubClassc�,�	t|j���r)rrrs rr z
SubClass.spam's����$�*�%�%�%rc�*�t|j���r)rrr"s  rr z
SubClass.spam,����$�*�%�%�%rc�*�t|j���r)rrrs rr z
SubClass.spam0r,rN)rrr	rr �getterr&r'r
rrr)r)%sm�������^��&�&���&�
�[�&�&��[�&�
�\�&�&��\�&�&�&rr)c�2�eZdZdZd�Zeed���ZdS)�PropertyDocBase�c��|jSrrrs r�	_get_spamzPropertyDocBase._get_spam6s
���z�r�spam spam spam��docN)rrr	rr3r%r r
rrr0r04s7������
�E�����8�I�#3�4�4�4�D�D�Drr0c�8�eZdZejjd���ZdS)�PropertyDocSubc��	|jSrrrs rr zPropertyDocSub.spam;s
��8��z�rN)rrr	r0r r.r
rrr8r8:s4�������� ���!� ���rr8c�8�eZdZejjd���ZdS)�PropertySubNewGetterc��	dSrr
rs rr zPropertySubNewGetter.spamA�
����qrN)rrr	rr r.r
rrr;r;@s3�������^��������rr;c�D�eZdZed���Zejd���ZdS)�PropertyNewGetterc��	dS�Nr1r
rs rr zPropertyNewGetter.spamGs
�� ��qrc��	dS)N�r
rs rr zPropertyNewGetter.spamKr=rN)rrr	r%r r.r
rrr?r?FsJ������
����X��
�[����[���rr?c��eZdZd�Zd�Zejejj	dkd��d���Z
ejejj	dkd��d���Zd�Zejejj	dkd��d���Z
d	�Zejejj	dkd��d
���Zejejj	dkd��d���Zejd���Zejejj	dkd��d
���Zejejj	dkd��d���Zd�Zd�ZdS)�
PropertyTestsc�2�t��}|�|jd��|�|jd��d|_|�|jd��|�|jd��t	|d��|�t
|d����|�t
|d����d|_|�|jd��|�|jd��dS)Nr�
r r�)r�assertEqualr r�delattr�
assertTrue�hasattr�r�bases  r�!test_property_decorator_baseclassz/PropertyTests.test_property_decorator_baseclassQs����{�{�������A�&�&�&������Q�'�'�'���	������B�'�'�'������R�(�(�(���f�������G�D�&�1�1�1�2�2�2����G�D�'�2�2�2�3�3�3���	������B�'�'�'������R�(�(�(�(�(rc���t��}|�tt|d��|�tt
|dd��|�tt|d��dS)Nr )r)�assertRaisesr�getattrr�setattrrrJ�r�subs  r� test_property_decorator_subclassz.PropertyTests.test_property_decorator_subclass`sa���j�j�����+�w��V�<�<�<����+�w��V�T�B�B�B����+�w��V�<�<�<�<�<r��)Docstrings are omitted with -O2 and abovec�l�t��}|�|jjjd��dS)NzSubClass.getter)r)rI�	__class__r �__doc__rTs  r�$test_property_decorator_subclass_docz2PropertyTests.test_property_decorator_subclass_docgs2���j�j�������+�3�5F�G�G�G�G�Grc�l�t��}|�|jjjd��dS)NzBaseClass.getter)rrIrZr r[rMs  r�%test_property_decorator_baseclass_docz3PropertyTests.test_property_decorator_baseclass_docms2���{�{�������,�4�6H�I�I�I�I�Irc���t��}t��}|�|jjjd��|�|jjjd��dS)Nr4)r0r8rIrZr r[)rrNrUs   r�test_property_decorator_docz)PropertyTests.test_property_decorator_docss\��� � �����������,�4�6F�G�G�G������+�3�5E�F�F�F�F�Frc�>�t��}|�|jd��|�|jjjd��t��}|�|jd��|�|jjjd��dS)Nrz
new docstringrC)r;rIr rZr[r?)r�newgettersub�	newgetters   r�!test_property_getter_doc_overridez/PropertyTests.test_property_getter_doc_overrideys���,�-�-������*�A�.�.�.�����/�4�<�o�N�N�N�%�'�'�	�������+�+�+�����,�1�9�?�K�K�K�K�Krc�t���ddgdgddfD]D�G�fd�dt��}|�|jjt	������EGd�d	t���|�t��5G�fd
�dt��}|jjddd��dS#1swxYwYdS)NTFr1��1c�:��eZdZd�Z�e_ee��ZdS)�EPropertyTests.test_property___isabstractmethod__descriptor.<locals>.Cc��dSrr
rs r�foozIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.foo�����DrN�rrr	rk�__isabstractmethod__r%)�vals�r�Cri�s3����������+.��(��h�s�m�m���rrpc��eZdZd�ZeZdS)�KPropertyTests.test_property___isabstractmethod__descriptor.<locals>.NotBoolc��t���r)�
ValueErrorrs r�__bool__zTPropertyTests.test_property___isabstractmethod__descriptor.<locals>.NotBool.__bool__�s�� �l�l�"rN)rrr	ru�__len__r
rr�NotBoolrr�s"������
#�
#�
#��G�G�Grrwc�J��eZdZd�Z���e_ee��ZdS)ric��dSrr
rs rrkzIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.foo�rlrNrm)rws�rrpzEPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C�s9����������+2�7�9�9��(��h�s�m�m���r)�object�assertIsrkrn�boolrQrt)rrprwros  @@r�,test_property___isabstractmethod__descriptorz:PropertyTests.test_property___isabstractmethod__descriptor�sa�����%��a�S�"�c�2�	A�	A�C�
$�
$�
$�
$�
$�
$�
$�F�
$�
$�
$�

�M�M�!�%�4�d�3�i�i�@�@�@�@�	�	�	�	�	�f�	�	�	��
�
�z�
*�
*�	'�	'�
$�
$�
$�
$�
$�
$�
$�F�
$�
$�
$�

�E�&�&�
	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	'�	's�>"B-�-B1�4B1c��td���}|�|jd��d|_|�|jd��dS)N�basicr5�extended)r%rIr[)r�ps  r�"test_property_builtin_doc_writablez0PropertyTests.test_property_builtin_doc_writable�sQ��
��!�!�!�������G�,�,�,���	������J�/�/�/�/�/rc��Gd�dt��}|��}|�|jjjd��d|jj_|�|jjjd��dS)Nc�$�eZdZed���ZdS)�OPropertyTests.test_property_decorator_doc_writable.<locals>.PropertyWritableDocc��	dS�N�eggsr
rs rr zTPropertyTests.test_property_decorator_doc_writable.<locals>.PropertyWritableDoc.spam�s
����vrN)rrr	r%r r
rr�PropertyWritableDocr��s-������
�
�
��X�
�
�
rr��Eggs�Spam)rzrIrZr r[)rr�rUs   r�$test_property_decorator_doc_writablez2PropertyTests.test_property_decorator_doc_writable�s���	�	�	�	�	�&�	�	�	�"�!�#�#�������+�3�V�<�<�<�%+��
��"������+�3�V�<�<�<�<�<rc��tjtd��}tdddd��}|��}t	d��D]}|�dddd���|�|��|z
dd�	��dS)
N�gettotalrefcount�fget�fset�fdelr6�drrG)�delta)r�
get_attribute�sysr%�ranger�assertAlmostEqual)rr��	fake_prop�refs_before�is     r�test_refleaks_in___init__z'PropertyTests.test_refleaks_in___init__�s���"�0��6H�I�I���V�V�V�U�;�;�	�&�&�(�(���s���	>�	>�A����v�v�v�u�=�=�=�=����/�/�1�1�K�?��"��M�M�M�M�Mrc�V�Gd�d��}|�|jd��dS)Nc�4�eZdZeed�����ZdS)�,PropertyTests.test_class_property.<locals>.Ac��d|jzS)NzA doc for %r)r��clss rr[z4PropertyTests.test_class_property.<locals>.A.__doc__�s��&���4�4rN�rrr	�classmethodr%r[r
rr�Ar��s7������
�
�
5�
5��X��[�
5�
5�
5rr�z
A doc for 'A'�rIr[�rr�s  r�test_class_propertyz!PropertyTests.test_class_property�sJ��	5�	5�	5�	5�	5�	5�	5�	5�
	
�����O�4�4�4�4�4rc�V�Gd�d��}|�|jd��dS)Nc�6�eZdZ	eed�����ZdS)�5PropertyTests.test_class_property_override.<locals>.Ac��dS)N�Secondr
r�s rr[z=PropertyTests.test_class_property_override.<locals>.A.__doc__�s	�� �xrNr�r
rrr�r��s:�������
�
�
 �
 ��X��[�
 �
 �
 rr�r�r�r�s  r�test_class_property_overridez*PropertyTests.test_class_property_override�sJ��	 �	 �	 �	 �	 �	 �	 �	 �	
�����H�-�-�-�-�-rc��t��}dD]G}|�td|�d���5|jdg|z�ddd��n#1swxYwY�HdS)N)rr1�z3^__set_name__\(\) takes 2 positional arguments but z were given$r)r%�assertRaisesRegex�	TypeError�__set_name__)rr�r�s   r�%test_property_set_name_incorrect_argsz3PropertyTests.test_property_set_name_incorrect_args�s����J�J���	+�	+�A��'�'��V�q�V�V�V���
+�
+����!��q��*�*�	
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+��	+�	+s�A
�
A	�A	c���Gd�dt��}Gd�d��}t�|��}|�|d��|�d���}dS)Nc��eZdZd�ZdS)�EPropertyTests.test_property_setname_on_property_subclass.<locals>.proc��dS)N�abcdefr
)�typ�args�kwargss   r�__new__zMPropertyTests.test_property_setname_on_property_subclass.<locals>.pro.__new__�s���xrN)rrr	r�r
rr�pror��s#������
 �
 �
 �
 �
 rr�c��eZdZdS)�CPropertyTests.test_property_setname_on_property_subclass.<locals>.ANrr
rrr�r��s�������Drr�r1c��dSrAr
rs r�<lambda>zJPropertyTests.test_property_setname_on_property_subclass.<locals>.<lambda>�s��1�r)r%r�r�r.)rr�r�r��nps     r�*test_property_setname_on_property_subclassz8PropertyTests.test_property_setname_on_property_subclass�s���	 �	 �	 �	 �	 �(�	 �	 �	 �	�	�	�	�	�	�	�	�
���S�!�!��	���q�!����
�X�X�n�n�
%�
%���rN)rrr	rOrV�unittest�skipIfr��flags�optimizer\r^r`rdr}r�r�r�
refcount_testr�r�r�r�r�r
rrrErEPsU������
)�
)�
)�=�=�=��X�_�S�Y�'�1�,�@�B�B�H�H�B�B�H��X�_�S�Y�'�1�,�@�B�B�J�J�B�B�J�G�G�G��X�_�S�Y�'�1�,�@�B�B�L�L�B�B�L�'�'�'�.�X�_�S�Y�'�1�,�@�B�B�0�0�B�B�0��X�_�S�Y�'�1�,�@�B�B�=�=�B�B�=�
��N�N���N��X�_�S�Y�'�1�,�@�B�B�5�5�B�B�5��X�_�S�Y�'�1�,�@�B�B�.�.�B�B�.�+�+�+�&�&�&�&�&rrEc��eZdZdS)�PropertySubNrr
rrr�r��s������(�(rr�c��eZdZ	dZdS)�PropertySubSlotsr
N)rrr	�	__slots__r
rrr�r��s������?��I�I�Irr�c��eZdZd�Zejejjdkd��d���Z	ejejjdkd��d���Z
ejejjdkd��d���ZdS)�PropertySubclassTestsc�j�	Gd�dt��}td���#t$rYdSwxYw)Nc�$�eZdZed���ZdS)�FPropertySubclassTests.test_slots_docstring_copy_exception.<locals>.Fooc��	dSrAr
rs rr zKPropertySubclassTests.test_slots_docstring_copy_exception.<locals>.Foo.spam�s
��O��1rN)rrr	r�r r
rr�Foor��s.������!���"�!���rr�zAttributeError not raised)rz�	Exception�AttributeError�rr�s  r�#test_slots_docstring_copy_exceptionz9PropertySubclassTests.test_slots_docstring_copy_exception�sf��		9�
�
�
�
�
�f�
�
�
��7�8�8�8���	�	�	��D�D�	���s�$�
2�2rWrXc�l�Gd�dt��}|�|jjd��dS)Nc�$�eZdZed���ZdS)�6PropertySubclassTests.test_docstring_copy.<locals>.Fooc��	dSrAr
rs rr z;PropertySubclassTests.test_docstring_copy.<locals>.Foo.spams
��7��qrN�rrr	r�r r
rrr�r��-������
�
�
��[�
�
�
rr��!spam wrapped in property subclass�rzrIr r[r�s  r�test_docstring_copyz)PropertySubclassTests.test_docstring_copys[��	�	�	�	�	�&�	�	�	�
	
����H��/�	1�	1�	1�	1�	1rc����Gd�dt������}|�|jd��d|_|�|jd��|��jjd��G�fd�d���}|��}|�|jd��d|_|�|jd	��|�|jjd��dS)
Nc�J�eZdZd�Zed���Zejd���ZdS)�OPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Fooc��d|_dSrArrs rrzXPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.__init__s��Q��
�
�
rc��	|jSrrrs rr zTPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.spams
��7��z�!rc��	||_dSrrr"s  rr zTPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.spams��/�"��
�
�
rN)rrr	rr�r r&r
rrr�r�sS������.�.�.�
�
"�
"��[�
"��[�
#�
#��[�
#�
#�
#rr�r1rWr�c�:��eZdZ�jjd���ZdS)�RPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSubc��	d|_dSr�rr"s  rr zWPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSub.spam"s��/�#��
�
�
rN)rrr	r r&)r�s�r�FooSubr�!s2�������
�X�_�
$�
$��_�
$�
$�
$rr��r�r�)rrkr��foosubr�s    @r�,test_property_setter_copies_getter_docstringzBPropertySubclassTests.test_property_setter_copies_getter_docstring
s9���		#�		#�		#�		#�		#�&�		#�		#�		#��c�e�e�������1�%�%�%���������1�%�%�%�����H��/�	1�	1�	1�	$�	$�	$�	$�	$�	$�	$�S�	$�	$�	$�
����������a�(�(�(���������f�-�-�-�����K��/�	1�	1�	1�	1�	1rc����Gd�dt��}|�|jjd��Gd�dt���G�fd�d���}|�|jjd��dS)Nc�D�eZdZed���Zejd���ZdS)�IPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Fooc��	dSrAr
rs rr zNPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo.spam3�
��!��qrc��	dS�NrWr
rs rr zNPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo.spam7�
��%��qrN)rrr	r�r r.r
rrr�r�2sJ������
�
�
��[�
��[�
�
��[�
�
�
rr�za new docstringc�$�eZdZed���ZdS)�MPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FooBasec��	dSrAr
rs rr zRPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FooBase.spam=r�rNr�r
rr�FooBaser�<r�rr�c�:��eZdZ�jjd���ZdS)�JPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo2c��	dSr�r
rs rr zOPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo2.spamBr�rN)rrr	r r.)r�s�r�Foo2r�As4�������
�\�
 �
�
�!�
 �
�
�
rr�r�)rr�r�r�s   @r�&test_property_new_getter_new_docstringz<PropertySubclassTests.test_property_new_getter_new_docstring.s����	�	�	�	�	�&�	�	�	�	
�����)�+<�=�=�=�	�	�	�	�	�f�	�	�	�
	�	�	�	�	�	�	�7�	�	�	�
	
�����)�+<�=�=�=�=�=rN)rrr	r�r�r�r�r�r�r�r�r�r
rrr�r��s�������
9�
9�
9��X�_�S�Y�'�1�,�@�B�B�1�1�B�B�1��X�_�S�Y�'�1�,�@�B�B�1�1�B�B�1�>�X�_�S�Y�'�1�,�@�B�B�>�>�B�B�>�>�>rr�c�H�eZdZdZdZdZd�Zed���Zd�Z	d�Z
d�ZdS)�_PropertyUnreachableAttributeNc�6�|j�|��Sr)�
msg_format�format)r�msgs  r�_format_exc_msgz-_PropertyUnreachableAttribute._format_exc_msgNs����%�%�c�*�*�*rc�8�|���|_dSr)r��objr�s r�
setUpClassz(_PropertyUnreachableAttribute.setUpClassQs���'�'�)�)����rc��|�t|�d����5|jjddd��dS#1swxYwYdS)Nz
has no getter�r�r�rrrkrs r�test_get_propertyz/_PropertyUnreachableAttribute.test_get_propertyUs���
�
#�
#�N�D�4H�4H��4Y�4Y�
Z�
Z�	�	��H�L�L�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��
A	�	A
�A
c��|�t|�d����5d|j_ddd��dS#1swxYwYdS)Nz
has no setterrrs r�test_set_propertyz/_PropertyUnreachableAttribute.test_set_propertyYs���
�
#�
#�N�D�4H�4H��4Y�4Y�
Z�
Z�	 �	 ��D�H�L�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 r
c��|�t|�d����5|j`ddd��dS#1swxYwYdS)Nzhas no deleterrrs r�test_del_propertyz/_PropertyUnreachableAttribute.test_del_property]s���
�
#�
#�N�D�4H�4H�IY�4Z�4Z�
[�
[�	�	����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�A)rrr	rrr�rr�r	rrrr
rrrrIsz�������J�
�C�
�C�+�+�+�����[����� � � �����rrc�,�eZdZdZGd�d��ZdS)�$PropertyUnreachableAttributeWithNamezI^property 'foo' of 'PropertyUnreachableAttributeWithName\.cls' object {}$c�"�eZdZe��ZdS)�(PropertyUnreachableAttributeWithName.clsN)rrr	r%rkr
rrr�res�������h�j�j���rr�N)rrr	rr�r
rrrrbsA������]�J����������rrc�J�eZdZdZGd�d��Ze��e_dS)�"PropertyUnreachableAttributeNoNamezA^property of 'PropertyUnreachableAttributeNoName\.cls' object {}$c��eZdZdS)�&PropertyUnreachableAttributeNoName.clsNrr
rrr�rls�������rr�N)rrr	rr�r%rkr
rrrrisJ������U�J�
�
�
�
�
�
�
�
��h�j�j�C�G�G�Grr�__main__)r�r��testrr�rrrrrzrr)r0r8r;r?�TestCaserEr%r�r�r�rrrr�mainr
rr�<module>rs=���
�
�
�����������	�	�	�	�	�9�	�	�	�	�	�	�	�	�,�	�	�	�	�	�	�	�	�,�	�	�	�	�	�	�	�	�,�	�	�	����������"
&�
&�
&�
&�
&�y�
&�
&�
&�5�5�5�5�5�f�5�5�5������_���������9�������������Y&�Y&�Y&�Y&�Y&�H�%�Y&�Y&�Y&�x)�)�)�)�)�(�)�)�)������x����S>�S>�S>�S>�S>�H�-�S>�S>�S>�l��������2�����+H�(�J[���������)F��HY�����z����H�M�O�O�O�O�O��r