ó
    Ö›‘h~  ã                   óÜ   • S r SSKJr  SSKJr  SSKJr   SSKJr  \r	\	(       a-  \R                  " 5       (       a  SSKJrJrJr  SSKJrJrJrJr  OSr	 " S	 S
\5      rg! \
 a    Sr	 NLf = f)ú'
Tests for L{twisted.python._inotify}.
é    )ÚFilePath)Úplatform)ÚTestCase)Ú_inotifyN)Úc_char_pÚc_intÚc_uint32)ÚINotifyErrorÚaddÚinitÚinitializeModulec                   óF   • \ rS rSrSr\c  SrS rS rS r	S r
S	 rS
 rSrg)ÚINotifyTestsé   r   Nz&This platform doesn't support INotify.c                 óX   •  " S S5      nU R                  [        [        U" 5       5        g)zq
If the I{libc} object passed to L{initializeModule} has no
C{inotify_init} attribute, L{ImportError} is raised.
c                   ó    • \ rS rSrS rS rSrg)Ú+INotifyTests.test_missingInit.<locals>.libcé)   c                 ó   • g ©N© ©Úselfs    ÚdC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/python/test/test_inotify.pyÚinotify_add_watchÚ=INotifyTests.test_missingInit.<locals>.libc.inotify_add_watch*   ó   € Øó    c                 ó   • g r   r   r   s    r   Úinotify_rm_watchÚ<INotifyTests.test_missingInit.<locals>.libc.inotify_rm_watch-   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r!   Ú__static_attributes__r   r   r   Úlibcr   )   ó   † òõr   r(   N©ÚassertRaisesÚImportErrorr   ©r   r(   s     r   Útest_missingInitÚINotifyTests.test_missingInit#   ó#   € ÷	ñ 	ð 	×Ñœ+Ô'7¹»Õ@r   c                 óX   •  " S S5      nU R                  [        [        U" 5       5        g)zv
If the I{libc} object passed to L{initializeModule} has no
C{inotify_add_watch} attribute, L{ImportError} is raised.
c                   ó    • \ rS rSrS rS rSrg)Ú*INotifyTests.test_missingAdd.<locals>.libcé8   c                 ó   • g r   r   r   s    r   Úinotify_initÚ7INotifyTests.test_missingAdd.<locals>.libc.inotify_init9   r   r   c                 ó   • g r   r   r   s    r   r!   Ú;INotifyTests.test_missingAdd.<locals>.libc.inotify_rm_watch<   r   r   r   N)r#   r$   r%   r&   r6   r!   r'   r   r   r   r(   r3   8   r)   r   r(   Nr*   r-   s     r   Útest_missingAddÚINotifyTests.test_missingAdd2   r0   r   c                 óX   •  " S S5      nU R                  [        [        U" 5       5        g)zu
If the I{libc} object passed to L{initializeModule} has no
C{inotify_rm_watch} attribute, L{ImportError} is raised.
c                   ó    • \ rS rSrS rS rSrg)Ú-INotifyTests.test_missingRemove.<locals>.libcéG   c                 ó   • g r   r   r   s    r   r6   Ú:INotifyTests.test_missingRemove.<locals>.libc.inotify_initH   r   r   c                 ó   • g r   r   r   s    r   r   Ú?INotifyTests.test_missingRemove.<locals>.libc.inotify_add_watchK   r   r   r   N)r#   r$   r%   r&   r6   r   r'   r   r   r   r(   r>   G   r)   r   r(   Nr*   r-   s     r   Útest_missingRemoveÚINotifyTests.test_missingRemoveA   r0   r   c                 óN  •  " S S5      nU" 5       n[        U5        U R                  UR                  R                  / 5        U R                  UR                  R                  [
        5        U R                  UR                  R                  [
        [
        /5        U R                  UR                  R                  [
        5        U R                  UR                  R                  [
        [        [        /5        U R                  UR                  R                  [
        5        g)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                   óV   • \ rS rSrS r\" \5      rS r\" \5      rS r\" \5      rSrg)Ú(INotifyTests.test_setTypes.<locals>.libcéW   c                 ó   • g r   r   r   s    r   r6   Ú5INotifyTests.test_setTypes.<locals>.libc.inotify_initX   r   r   c                 ó   • g r   r   r   s    r   r!   Ú9INotifyTests.test_setTypes.<locals>.libc.inotify_rm_watch]   r   r   c                 ó   • g r   r   r   s    r   r   Ú:INotifyTests.test_setTypes.<locals>.libc.inotify_add_watchb   r   r   r   N)	r#   r$   r%   r&   r6   Ústaticmethodr!   r   r'   r   r   r   r(   rH   W   s9   † òñ (¨Ó5ˆLòñ  ,Ð,<Ó=Ðòñ !-Ð->Ó ?Ór   r(   N)
r   ÚassertEqualr6   ÚargtypesÚrestyper	   r!   r   r   r
   )r   r(   Úcs      r   Útest_setTypesÚINotifyTests.test_setTypesP   sÎ   € ÷	@ñ 	@ñ  ‹FˆÜ˜ÔØ×Ñ˜Ÿ™×0Ñ0°"Ô5Ø×Ñ˜Ÿ™×/Ñ/´Ô7à×Ñ˜×+Ñ+×4Ñ4´u¼e°nÔEØ×Ñ˜×+Ñ+×3Ñ3´UÔ;à×Ñ˜×,Ñ,×5Ñ5¼¼xÌÐ7RÔSØ×Ñ˜×,Ñ,×4Ñ4´eÕ<r   c                 ó„   •  " S S5      nU R                  [        SU" 5       5        U R                  [        [        5        g)zO
If C{inotify_init} returns a negative number, L{init} raises
L{INotifyError}.
c                   ó   • \ rS rSrS rSrg)Ú*INotifyTests.test_failedInit.<locals>.libcéx   c                 ó   • g©Néÿÿÿÿr   r   s    r   r6   Ú7INotifyTests.test_failedInit.<locals>.libc.inotify_inity   ó   € Ør   r   N)r#   r$   r%   r&   r6   r'   r   r   r   r(   rY   x   ó   † õr   r(   N)ÚpatchÚinotifyr+   r   r   r-   s     r   Útest_failedInitÚINotifyTests.test_failedInitr   s0   € ÷	ñ 	ð 	�
‰
”7˜F¡D£FÔ+Ø×Ñœ,¬Õ-r   c                 óœ   •  " S S5      nU R                  [        SU" 5       5        U R                  [        [        S[        S5      S5        g)zS
If C{inotify_add_watch} returns a negative number, L{add}
raises L{INotifyError}.
c                   ó   • \ rS rSrS rSrg)Ú.INotifyTests.test_failedAddWatch.<locals>.libcé…   c                 ó   • gr\   r   )r   ÚfdÚpathÚmasks       r   r   Ú@INotifyTests.test_failedAddWatch.<locals>.libc.inotify_add_watch†   r_   r   r   N)r#   r$   r%   r&   r   r'   r   r   r   r(   rg   …   r`   r   r(   é   z/foor   N)ra   rb   r+   r   r   r   r-   s     r   Útest_failedAddWatchÚ INotifyTests.test_failedAddWatch   s;   € ÷	ñ 	ð 	�
‰
”7˜F¡D£FÔ+Ø×Ñœ,¬¨Q´¸Ó0@À!ÕDr   r   )r#   r$   r%   r&   Ú__doc__rb   Úskipr.   r:   rD   rU   rc   ro   r'   r   r   r   r   r      s6   † ñð �Ø7ˆòAòAòAò =òD.õEr   r   )rq   Útwisted.python.filepathr   Útwisted.python.runtimer   Útwisted.trial.unittestr   Útwisted.pythonr   rb   r,   ÚsupportsINotifyÚctypesr   r	   r
   Útwisted.python._inotifyr   r   r   r   r   r   r   r   Ú<module>rz      sl   ðñõ -Ý +Ý +ðÝ'ð €Gæ
ˆx×'Ò'×)Ñ)ß0Ñ0çQÔQà€GôoE�8õ oEøð ó Ø‚Gðús   –A  Á A+Á*A+