+
    üÐj~  ã                   óä   € R t ^ RIHt ^ RIHt ^ RIHt  ^ RIHt ]t	]	'       d/   ]P                  ! 4       '       d   ^ RIHtHtHt ^ RIHtHtHtHt MRt	 ! R R	]4      tR#   ]
 d    Rt	 LPi ; i)
ú'
Tests for L{twisted.python._inotify}.
)ÚFilePath)Úplatform)ÚTestCase)Ú_inotifyN)Úc_char_pÚc_intÚc_uint32)ÚINotifyErrorÚaddÚinitÚinitializeModulec                   óT   a € ] tR t^t o Rt]f   RtR tR tR t	R t
R tR	 tR
tV tR# )ÚINotifyTestsr   Nz&This platform doesn't support INotify.c                óZ   €  ! R R4      pV P                  \        \        V! 4       4       R# )zq
If the I{libc} object passed to L{initializeModule} has no
C{inotify_init} attribute, L{ImportError} is raised.
c                   ó,   a € ] tR t^)t o R tR tRtV tR# )Ú+INotifyTests.test_missingInit.<locals>.libcc                ó   € R # ©N© ©Úselfs   &ÚB/usr/lib/python3/dist-packages/twisted/python/test/test_inotify.pyÚinotify_add_watchÚ=INotifyTests.test_missingInit.<locals>.libc.inotify_add_watch*   ó   € Ùó    c                ó   € R # 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__Ú__classdictcell__©Ú__classdict__s   @r   Úlibcr   )   ó   ø‡ € ò÷ð r   r(   N©ÚassertRaisesÚImportErrorr   ©r   r(   s   & r   Útest_missingInitÚINotifyTests.test_missingInit#   ó#   € ÷	ñ 	ð 	×Ñœ+Ô'7¹»Ö@r   c                óZ   €  ! R R4      pV P                  \        \        V! 4       4       R# )zv
If the I{libc} object passed to L{initializeModule} has no
C{inotify_add_watch} attribute, L{ImportError} is raised.
c                   ó,   a € ] tR t^8t o R tR tRtV tR# )Ú*INotifyTests.test_missingAdd.<locals>.libcc                ó   € R # r   r   r   s   &r   Úinotify_initÚ7INotifyTests.test_missingAdd.<locals>.libc.inotify_init9   r   r   c                ó   € R # r   r   r   s   &r   r   Ú;INotifyTests.test_missingAdd.<locals>.libc.inotify_rm_watch<   r   r   r   N)r    r!   r"   r#   r5   r   r$   r%   r&   s   @r   r(   r3   8   r)   r   r(   Nr*   r-   s   & r   Útest_missingAddÚINotifyTests.test_missingAdd2   r0   r   c                óZ   €  ! R R4      pV P                  \        \        V! 4       4       R# )zu
If the I{libc} object passed to L{initializeModule} has no
C{inotify_rm_watch} attribute, L{ImportError} is raised.
c                   ó,   a € ] tR t^Gt o R tR tRtV tR# )Ú-INotifyTests.test_missingRemove.<locals>.libcc                ó   € R # r   r   r   s   &r   r5   Ú:INotifyTests.test_missingRemove.<locals>.libc.inotify_initH   r   r   c                ó   € R # r   r   r   s   &r   r   Ú?INotifyTests.test_missingRemove.<locals>.libc.inotify_add_watchK   r   r   r   N)r    r!   r"   r#   r5   r   r$   r%   r&   s   @r   r(   r=   G   r)   r   r(   Nr*   r-   s   & r   Útest_missingRemoveÚINotifyTests.test_missingRemoveA   r0   r   c                óP  €  ! R R4      pV! 4       p\        V4       V P                  VP                  P                  . 4       V P                  VP                  P                  \
        4       V P                  VP                  P                  \
        \
        .4       V P                  VP                  P                  \
        4       V P                  VP                  P                  \
        \        \        .4       V P                  VP                  P                  \
        4       R# )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   a € ] tR t^Wt o R t]! ]4      tR t]! ]4      tR t]! ]4      tRtV t	R# )Ú(INotifyTests.test_setTypes.<locals>.libcc                ó   € R # r   r   r   s   &r   r5   Ú5INotifyTests.test_setTypes.<locals>.libc.inotify_initX   r   r   c                ó   € R # r   r   r   s   &r   r   Ú9INotifyTests.test_setTypes.<locals>.libc.inotify_rm_watch]   r   r   c                ó   € R # r   r   r   s   &r   r   Ú:INotifyTests.test_setTypes.<locals>.libc.inotify_add_watchb   r   r   r   N)
r    r!   r"   r#   r5   Ústaticmethodr   r   r$   r%   r&   s   @r   r(   rF   W   s<   ø‡ € òñ (¨Ó5ˆLòñ  ,Ð,<Ó=Ðòñ !-Ð->Ó ?Ör   r(   N)
r   ÚassertEqualr5   Ú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                ó†   €  ! R R4      pV P                  \        RV! 4       4       V P                  \        \        4       R# )zO
If C{inotify_init} returns a negative number, L{init} raises
L{INotifyError}.
c                   ó&   a € ] tR t^xt o R tRtV tR# )Ú*INotifyTests.test_failedInit.<locals>.libcc                ó   € R# ©é   éÿÿÿÿr   r   s   &r   r5   Ú7INotifyTests.test_failedInit.<locals>.libc.inotify_inity   ó   € Ø�	r   r   N)r    r!   r"   r#   r5   r$   r%   r&   s   @r   r(   rV   x   ó   ø‡ € ÷ð r   r(   N)ÚpatchÚinotifyr+   r
   r   r-   s   & r   Útest_failedInitÚINotifyTests.test_failedInitr   s0   € ÷	ñ 	ð 	�
‰
”7˜F¡D£FÔ+Ø×Ñœ,¬Ö-r   c                óž   €  ! R R4      pV P                  \        RV! 4       4       V P                  \        \        ^\        R4      ^ 4       R# )zS
If C{inotify_add_watch} returns a negative number, L{add}
raises L{INotifyError}.
c                   ó&   a € ] tR t^…t o R tRtV tR# )Ú.INotifyTests.test_failedAddWatch.<locals>.libcc                ó   € R# rX   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&   s   @r   r(   rd   …   r]   r   r(   z/fooN)r^   r_   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__r_   Úskipr.   r9   rB   rR   r`   rj   r$   r%   r&   s   @r   r   r      s?   ø‡ € ñð ‚Ø7ˆòAòAòAò =òD.÷Eð Er   r   )rl   Útwisted.python.filepathr   Útwisted.python.runtimer   Útwisted.trial.unittestr   Útwisted.pythonr   r_   r,   ÚsupportsINotifyÚctypesr   r   r	   Útwisted.python._inotifyr
   r   r   r   r   r   r   r   Ú<module>ru      sl   ðñõ -Ý +Ý +ðÝ'ð €Gç
ˆx×'Ò'×)Ò)ß0Ñ0çQÔQà€GôoE�8ö oEøð ô Ø‚Gðús   –A# Á#	A/Á.A/