Ë
    ¸2Úi'  ã                   ó”   — d dl mZ ddlmZmZ ddlmZ ddlmZ  G d„ de«      Z G d	„ d
e«      Z	dZ
 G d„ de«      Z G d„ de«      Zy)é    )Úmodelsé   )ÚSafeDeleteManagerÚSafeDeleteQueryset)ÚSafeDeleteModelé   )ÚSafeDeleteTestCasec                   ó   — e Zd Zd„ Zy)ÚCustomQuerySetc                 ó&   — | j                  d¬«      S )NÚgreen©Úcolor)Úfilter©Úselfs    ú\/var/www/html/acx/venv/lib/python3.12/site-packages/safedelete/tests/test_custom_queryset.pyr   zCustomQuerySet.green
   s   € Ø�{‰{Øð ó 
ð 	
ó    N)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r   r      s   „ ó
r   r   c                   ó   — e Zd ZeZd„ Zy)ÚCustomManagerc                 ó>   — | j                  «       j                  «       S )zDImplemented here so ``green`` available as manager's method
        )Úget_querysetr   r   s    r   r   zCustomManager.green   s   € ð × Ñ Ó"×(Ñ(Ó*Ð*r   N)r   r   r   r   Ú_queryset_classr   r   r   r   r   r      s   „ Ø$€Oó+r   r   ))ÚredÚRed)r   ÚGreenc                   óR   — e Zd Z ej                  de¬«      Z e«       Z e	e
«      Zy)ÚCustomQuerySetModelé   )Ú
max_lengthÚchoicesN)r   r   r   r   Ú	CharFieldr%   r   r   Úobjectsr   r   Úother_objectsr   r   r   r"   r"      s/   „ ØˆF×ÑØØô€Eñ
 ‹o€Gñ & nÓ5�Mr   r"   c                   ó4   — e Zd Zd„ Zd„ Zd„ Zd„ Zed„ «       Zy)ÚCustomQuerySetTestCasec                 ó€  — t         j                  j                  t        d   d   ¬«       t         j                  j                  t        d   d   ¬«       | j	                  t         j                  j                  «       d«       | j	                  t         j                  j                  «       j                  «       d«       y)z:Test whether creating a custom queryset works as intended.r   r   r   r   N)r"   r'   Úcreater%   ÚassertEqualÚcountr   r   s    r   Ú&test_custom_queryset_original_behaviorz=CustomQuerySetTestCase.test_custom_queryset_original_behavior-   s—   € ä×#Ñ#×*Ñ*Ü˜!‘*˜Q‘-ð 	+ô 	
ô 	×#Ñ#×*Ñ*Ü˜!‘*˜Q‘-ð 	+ô 	
ð 	×ÑÔ,×4Ñ4×:Ñ:Ó<¸aÔ@Ø×ÑÔ,×4Ñ4×:Ñ:Ó<×BÑBÓDÀaÕHr   c                 ó  — | j                  «       }|j                  «        t        j                  j	                  «       }| j                  |j                  «       d«       | j                  |j                  «       j                  «       d«       y)z'Test custom filters for deleted objectsr   N)Ú_create_green_instanceÚdeleter"   r'   Údeleted_onlyr-   r.   r   ©r   Úinstancer3   s      r   Ú"test_custom_queryset_custom_methodz9CustomQuerySetTestCase.test_custom_queryset_custom_method9   sm   € à×.Ñ.Ó0ˆØ�‰Ôä*×2Ñ2×?Ñ?ÓAˆð 	×Ñ˜×+Ñ+Ó-¨qÔ1ð 	×Ñ˜×+Ñ+Ó-×3Ñ3Ó5°qÕ9r   c                 ó  — | j                  «       }|j                  «        t        j                  j	                  «       }| j                  |j                  «       d«       | j                  |j                  «       j                  «       d«       y)zHTest whether custom queryset may be used without custom manager
        r   N)r1   r2   r"   r(   r3   r-   r.   r   r4   s      r   Ú$test_custom_queryset_without_managerz;CustomQuerySetTestCase.test_custom_queryset_without_managerF   sq   € ð ×.Ñ.Ó0ˆØ�‰Ôô +×8Ñ8×EÑEÓGˆð 	×Ñ˜×+Ñ+Ó-¨qÔ1ð 	×Ñ˜×+Ñ+Ó-×3Ñ3Ó5°qÕ9r   c                 óŽ   — t         j                  «       }| j                  |t        «       | j	                  t        |d«      «       y)zETest whether SafeDeleteQueryset as_manager works as intended
        Ú
as_managerN)r   r:   ÚassertIsInstancer   ÚassertFalseÚhasattr)r   Úmanagers     r   Ú-test_custom_queryset_as_manager_is_safedeletezDCustomQuerySetTestCase.test_custom_queryset_as_manager_is_safedeleteU   s8   € ô !×+Ñ+Ó-ˆØ×Ñ˜gÔ'8Ô9Ø×Ñœ ¨,Ó7Õ8r   c                  óV   — t         j                  j                  t        d   d   ¬«      S )z?Shortcut for creating instance with ``color == green``
        r   r   r   )r"   r'   r,   r%   r   r   r   r1   z-CustomQuerySetTestCase._create_green_instance\   s&   € ô #×*Ñ*×1Ñ1¼À¹
À1¹Ð1ÓFÐFr   N)	r   r   r   r/   r6   r8   r?   Ústaticmethodr1   r   r   r   r*   r*   +   s-   „ ò
Iò:ò:ò9ð ñGó ñGr   r*   N)Ú	django.dbr   Úmanagersr   r   r   Útestcaser	   r   r   r%   r"   r*   r   r   r   ú<module>rE      sM   ðÝ ç <Ý $Ý (ô
Ð'ô 
ô+Ð%ô +ð€ô	6˜/ô 	6ô5GÐ/õ 5Gr   