Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_property.cpython-311.opt-1.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)�BaseClass.getterrrs r�spamzBaseClass.spam����z�rc��||_dS�Nr�r�values  rrzBaseClass.spams
����
�
�
rc�
�|`dSr"rrs rrzBaseClass.spam!s���J�J�JrN)rrr	r�propertyr�setter�deleterr
rrrrsx�������������X��
�[����[��
�\����\���rrc�x�eZdZejjd���Zejd���Zejd���ZdS)�SubClassc�*�t|j���)�SubClass.getter)rrrs rrz
SubClass.spam's���$�*�%�%�%rc�*�t|j���r")rrr#s  rrz
SubClass.spam,����$�*�%�%�%rc�*�t|j���r")rrrs rrz
SubClass.spam0r.rN)rrr	rr�getterr'r(r
rrr*r*%sm�������^��&�&���&�
�[�&�&��[�&�
�\�&�&��\�&�&�&rr*c�2�eZdZdZd�Zeed���ZdS)�PropertyDocBase�c��|jSr"rrs r�	_get_spamzPropertyDocBase._get_spam6s
���z�r�spam spam spam��docN)rrr	rr5r&rr
rrr2r24s7������
�E�����8�I�#3�4�4�4�D�D�Drr2c�8�eZdZejjd���ZdS)�PropertyDocSubc��|jS)z*The decorator does not use this doc stringrrs rrzPropertyDocSub.spam;r rN)rrr	r2rr0r
rrr:r::s4�������� ���!� ���rr:c�8�eZdZejjd���ZdS)�PropertySubNewGetterc��dS)�
new docstringrr
rs rrzPropertySubNewGetter.spamA�	���qrN)rrr	rrr0r
rrr=r=@s3�������^��������rr=c�D�eZdZed���Zejd���ZdS)�PropertyNewGetterc��dS)zoriginal docstringr3r
rs rrzPropertyNewGetter.spamGr@rc��dS)r?�r
rs rrzPropertyNewGetter.spamKr@rN)rrr	r&rr0r
rrrBrBFsJ������
����X��
�[����[���rrBc��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�
rr�)r�assertEqualrr�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�setattrrrL�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)Nr,)r*rK�	__class__r�__doc__rVs  r�$test_property_decorator_subclass_docz2PropertyTests.test_property_decorator_subclass_docgs2���j�j�������+�3�5F�G�G�G�G�Grc�l�t��}|�|jjjd��dS)Nr)rrKr\rr]rOs  r�%test_property_decorator_baseclass_docz3PropertyTests.test_property_decorator_baseclass_docms2���{�{�������,�4�6H�I�I�I�I�Irc���t��}t��}|�|jjjd��|�|jjjd��dS)Nr6)r2r:rKr\rr])rrPrWs   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)Nrr?rE)r=rKrr\r]rB)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)NTFr3��1c�:��eZdZd�Z�e_ee��ZdS)�EPropertyTests.test_property___isabstractmethod__descriptor.<locals>.Cc��dSr"r
rs r�foozIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.foo�����DrN�rrr	rm�__isabstractmethod__r&)�vals�r�Crk�s3����������+.��(��h�s�m�m���rrrc��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	rw�__len__r
rr�NotBoolrt�s"������
#�
#�
#��G�G�Grryc�J��eZdZd�Z���e_ee��ZdS)rkc��dSr"r
rs rrmzIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.foo�rnrNro)rys�rrrzEPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C�s9����������+2�7�9�9��(��h�s�m�m���r)�object�assertIsrmrp�boolrSrv)rrrryrqs  @@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�basicr7�extended)r&rKr])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)�Eggs�eggsr
rs rrzTPropertyTests.test_property_decorator_doc_writable.<locals>.PropertyWritableDoc.spam�s	���vrN)rrr	r&rr
rr�PropertyWritableDocr��s-������
�
�
��X�
�
�
rr�r��Spam)r|rKr\rr])rr�rWs   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�fdelr8�drrI)�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'�rKr]�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�8�eZdZdZeed�����ZdS)�5PropertyTests.test_class_property_override.<locals>.A�Firstc��dS)N�Secondr
r�s rr]z=PropertyTests.test_class_property_override.<locals>.A.__doc__�s	�� �xrN)rrr	r]r�r&r
rrr�r��s<�������K�
�
�
 �
 ��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)rr3�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�r3c��dS�Nr3r
rs r�<lambda>zJPropertyTests.test_property_setname_on_property_subclass.<locals>.<lambda>�s��1�r)r&r�r�r0)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	rQrX�unittest�skipIfr��flags�optimizer^r`rbrfrr�r�r�
refcount_testr�r�r�r�r�r
rrrGrGPsU������
)�
)�
)�=�=�=��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�.�+�+�+�&�&�&�&�&rrGc��eZdZdZdS)�PropertySubzThis is a subclass of propertyN)rrr	r]r
rrr�r��s������(�(�(�(rr�c��eZdZdZdZdS)�PropertySubSlotsz5This is a subclass of property that defines __slots__r
N)rrr	r]�	__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��dS)z5Trying to copy this docstring will raise an exceptionr3r
rs rrzKPropertySubclassTests.test_slots_docstring_copy_exception.<locals>.Foo.spam�s	���1rN)rrr	r�rr
rr�Foor��s.������!���"�!���rr�zAttributeError not raised)r|�	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�2rYrZc�l�Gd�dt��}|�|jjd��dS)Nc�$�eZdZed���ZdS)�6PropertySubclassTests.test_docstring_copy.<locals>.Fooc��dS)�!spam wrapped in property subclassr3r
rs rrz;PropertySubclassTests.test_docstring_copy.<locals>.Foo.spam�	���qrN�rrr	r�rr
rrr�r��-������
�
�
��[�
�
�
rr�r��r|rKrr]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|_dSr�rrs rrzXPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.__init__s��Q��
�
�
rc��|jS)r�rrs rrzTPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.spams���z�!rc��||_dS)zthis docstring is ignoredNrr#s  rrzTPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.spams��#��
�
�
rN)rrr	rr�rr'r
rrr�r�sS������.�.�.�
�
"�
"��[�
"��[�
#�
#��[�
#�
#�
#rr�r3rYr�c�:��eZdZ�jjd���ZdS)�RPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSubc��d|_dS)zanother ignored docstringr�Nrr#s  rrzWPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSub.spam"s��$��
�
�
rN)rrr	rr')r�s�r�FooSubr�!s2�������
�X�_�
$�
$��_�
$�
$�
$rr��r�r�)rrmr��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��dS�za docstringr3r
rs rrzNPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo.spam3r�rc��dS��a new docstringrYr
rs rrzNPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo.spam7r�rN)rrr	r�rr0r
rrr�r�2sJ������
�
�
��[�
��[�
�
��[�
�
�
rr�r�c�$�eZdZed���ZdS)�MPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FooBasec��dSr�r
rs rrzRPropertySubclassTests.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rzOPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo2.spamBr�rN)rrr	rr0)r�s�r�Foo2r�As4�������
�\�
 �
�
�!�
 �
�
�
rrr�)rr�rr�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�rr
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�r	rrmrs 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�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �	 �	 rc��|�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�r	r�rrrrr
rrrrIsz�������J�
�C�
�C�+�+�+�����[����� � � �����rrc�,�eZdZdZGd�d��ZdS)�$PropertyUnreachableAttributeWithNamezI^property 'foo' of 'PropertyUnreachableAttributeWithName\.cls' object {}$c�"�eZdZe��ZdS)�(PropertyUnreachableAttributeWithName.clsN)rrr	r&rmr
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&rmr
rrrrisJ������U�J�
�
�
�
�
�
�
�
��h�j�j�C�G�G�Grr�__main__)r�r��testrr�rrrrr|rr*r2r:r=rB�TestCaserGr&r�r�r�rrrr�mainr
rr�<module>r!s=���
�
�
�����������	�	�	�	�	�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