§
    Ètºf~  ã                   óÌ   — d Z ddlmZ ddlmZ ddlmZ 	 ddlmZ eZ	n# e
$ r dZ	Y nw xY we	r& ej        ¦   «         rddlmZmZmZ ddlmZmZmZmZ ndZ	 G d	„ d
e¦  «        ZdS )z'
Tests for L{twisted.python._inotify}.
é    )ÚFilePath)Úplatform)ÚTestCase)Ú_inotifyN)Úc_char_pÚc_intÚc_uint32)ÚINotifyErrorÚaddÚinitÚinitializeModulec                   ó>   — e Zd ZdZe€dZd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ ZdS )
ÚINotifyTestsz/
    Tests for L{twisted.python._inotify}.
    Nz&This platform doesn't support INotify.c                 ór   —  G d„ d¦  «        }|                       t          t           |¦   «         ¦  «         dS )z‰
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_init} attribute, L{ImportError} is raised.
        c                   ó   — e Zd Zd„ Zd„ ZdS )ú+INotifyTests.test_missingInit.<locals>.libcc                 ó   — d S ©N© ©Úselfs    ú_/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/test/test_inotify.pyÚinotify_add_watchz=INotifyTests.test_missingInit.<locals>.libc.inotify_add_watch*   ó   € Ø�ó    c                 ó   — d S r   r   r   s    r   Úinotify_rm_watchz<INotifyTests.test_missingInit.<locals>.libc.inotify_rm_watch-   r   r   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   Úlibcr   )   ó2   € € € € € ðð ð ðð ð ð ð r   r!   N©ÚassertRaisesÚImportErrorr   ©r   r!   s     r   Útest_missingInitzINotifyTests.test_missingInit#   óQ   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	×Ò�+Õ'7¸¸¹¼Ñ@Ô@Ð@Ð@Ð@r   c                 ór   —  G d„ d¦  «        }|                       t          t           |¦   «         ¦  «         dS )zŽ
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_add_watch} attribute, L{ImportError} is raised.
        c                   ó   — e Zd Zd„ Zd„ ZdS )ú*INotifyTests.test_missingAdd.<locals>.libcc                 ó   — d S r   r   r   s    r   Úinotify_initz7INotifyTests.test_missingAdd.<locals>.libc.inotify_init9   r   r   c                 ó   — d S r   r   r   s    r   r   z;INotifyTests.test_missingAdd.<locals>.libc.inotify_rm_watch<   r   r   N)r   r   r    r-   r   r   r   r   r!   r+   8   r"   r   r!   Nr#   r&   s     r   Útest_missingAddzINotifyTests.test_missingAdd2   r(   r   c                 ór   —  G d„ d¦  «        }|                       t          t           |¦   «         ¦  «         dS )z�
        If the I{libc} object passed to L{initializeModule} has no
        C{inotify_rm_watch} attribute, L{ImportError} is raised.
        c                   ó   — e Zd Zd„ Zd„ ZdS )ú-INotifyTests.test_missingRemove.<locals>.libcc                 ó   — d S r   r   r   s    r   r-   z:INotifyTests.test_missingRemove.<locals>.libc.inotify_initH   r   r   c                 ó   — d S r   r   r   s    r   r   z?INotifyTests.test_missingRemove.<locals>.libc.inotify_add_watchK   r   r   N)r   r   r    r-   r   r   r   r   r!   r2   G   r"   r   r!   Nr#   r&   s     r   Útest_missingRemovezINotifyTests.test_missingRemoveA   r(   r   c                 ó,  —  G d„ d¦  «        } |¦   «         }t          |¦  «         |                      |j        j        g ¦  «         |                      |j        j        t
          ¦  «         |                      |j        j        t
          t
          g¦  «         |                      |j        j        t
          ¦  «         |                      |j        j        t
          t          t          g¦  «         |                      |j        j        t
          ¦  «         dS )zØ
        If the I{libc} object passed to L{initializeModule} has all of the
        necessary attributes, it sets the C{argtypes} and C{restype} attributes
        of the three ctypes methods used from libc.
        c                   ób   — e Zd Zd„ Z ee¦  «        Zd„ Z ee¦  «        Zd„ Z ee¦  «        ZdS )ú(INotifyTests.test_setTypes.<locals>.libcc                 ó   — d S r   r   r   s    r   r-   z5INotifyTests.test_setTypes.<locals>.libc.inotify_initX   r   r   c                 ó   — d S r   r   r   s    r   r   z9INotifyTests.test_setTypes.<locals>.libc.inotify_rm_watch]   r   r   c                 ó   — d S r   r   r   s    r   r   z:INotifyTests.test_setTypes.<locals>.libc.inotify_add_watchb   r   r   N)r   r   r    r-   Ústaticmethodr   r   r   r   r   r!   r8   W   st   € € € € € ðð ð ð (˜<¨Ñ5Ô5ˆLðð ð ð  ,˜|Ð,<Ñ=Ô=Ððð ð ð !- Ð->Ñ ?Ô ?ÐÐÐr   r!   N)
r   ÚassertEqualr-   ÚargtypesÚrestyper   r   r   r   r	   )r   r!   Úcs      r   Útest_setTypeszINotifyTests.test_setTypesP   s  € ð	@ð 	@ð 	@ð 	@ð 	@ñ 	@ô 	@ð 	@ð  ˆD‰FŒFˆÝ˜ÑÔÐØ×Ò˜œÔ0°"Ñ5Ô5Ð5Ø×Ò˜œÔ/µÑ7Ô7Ð7à×Ò˜Ô+Ô4µu½e°nÑEÔEÐEØ×Ò˜Ô+Ô3µUÑ;Ô;Ð;à×Ò˜Ô,Ô5½½xÍÐ7RÑSÔSÐSØ×Ò˜Ô,Ô4µeÑ<Ô<Ð<Ð<Ð<r   c                 ó¨   —  G d„ d¦  «        }|                       t          d |¦   «         ¦  «         |                      t          t          ¦  «         dS )zg
        If C{inotify_init} returns a negative number, L{init} raises
        L{INotifyError}.
        c                   ó   — e Zd Zd„ ZdS )ú*INotifyTests.test_failedInit.<locals>.libcc                 ó   — dS ©Néÿÿÿÿr   r   s    r   r-   z7INotifyTests.test_failedInit.<locals>.libc.inotify_inity   ó   € Ø�rr   N)r   r   r    r-   r   r   r   r!   rD   x   ó#   € € € € € ðð ð ð ð r   r!   N)ÚpatchÚinotifyr$   r
   r   r&   s     r   Útest_failedInitzINotifyTests.test_failedInitr   sd   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	�
Š
•7˜F D D¡F¤FÑ+Ô+Ð+Ø×Ò�,­Ñ-Ô-Ð-Ð-Ð-r   c                 óÈ   —  G d„ d¦  «        }|                       t          d |¦   «         ¦  «         |                      t          t          dt          d¦  «        d¦  «         dS )zk
        If C{inotify_add_watch} returns a negative number, L{add}
        raises L{INotifyError}.
        c                   ó   — e Zd Zd„ ZdS )ú.INotifyTests.test_failedAddWatch.<locals>.libcc                 ó   — dS rF   r   )r   ÚfdÚpathÚmasks       r   r   z@INotifyTests.test_failedAddWatch.<locals>.libc.inotify_add_watch†   rH   r   N)r   r   r    r   r   r   r   r!   rO   …   rI   r   r!   é   z/foor   N)rJ   rK   r$   r
   r   r   r&   s     r   Útest_failedAddWatchz INotifyTests.test_failedAddWatch   sr   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	�
Š
•7˜F D D¡F¤FÑ+Ô+Ð+Ø×Ò�,­¨Qµ¸Ñ0@Ô0@À!ÑDÔDÐDÐDÐDr   )r   r   r    Ú__doc__rK   Úskipr'   r/   r5   rA   rL   rU   r   r   r   r   r      s“   € € € € € ðð ð €Ø7ˆðAð Að AðAð Að AðAð Að Að =ð  =ð  =ðD.ð .ð .ðEð Eð Eð Eð Er   r   )rV   Útwisted.python.filepathr   Útwisted.python.runtimer   Útwisted.trial.unittestr   Útwisted.pythonr   rK   r%   ÚsupportsINotifyÚctypesr   r   r	   Útwisted.python._inotifyr
   r   r   r   r   r   r   r   ú<module>r_      s<  ððð ð -Ð ,Ð ,Ð ,Ð ,Ð ,Ø +Ð +Ð +Ð +Ð +Ð +Ø +Ð +Ð +Ð +Ð +Ð +ðØ'Ð'Ð'Ð'Ð'Ð'ð €G€Gøð ð ð ð Ø€G€G€Gðøøøð
 ð Ð'ˆxÔ'Ñ)Ô)ð Ø0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0àQÐQÐQÐQÐQÐQÐQÐQÐQÐQÐQÐQÐQà€GðoEð oEð oEð oEð oE�8ñ oEô oEð oEð oEð oEs   – Ÿ)¨)