%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/test_gireactor.cpython-312.pyc

�

Ϫ�f����dZddlmZddlmZ	ddlmZdZddlm	Z	ddl
mZmZddl
mZdd	�Zd
j!d�e	j"dd
�j%d�D��Zed�Ze�eneZddlmZddlmZddlmZmZesdZeduxsedvZde e���Z!esddlm"Z"Gd�dee�Z#y#e$rdZdZY�MwxYw)z\
GObject Introspection reactor tests; i.e. `gireactor` module for gio/glib/gtk
integration.
�)�annotations)�skipIf)�GioT)�environ)�get_required_version�require_version)�	gireactorc�`�	td|�y#t$r}t|�cYd}~Sd}~wwxYw)N�Gtk�)r�
ValueError�str)�someVersion�ves  �F/usr/lib/python3/dist-packages/twisted/internet/test/test_gireactor.py�requireEachrs1��	��E�;�/����	��r�7�N��	�s��	-�
(�-�-z, c#�2K�|]}t|����y�w)N)r)�.0�versions  r�	<genexpr>r"s������	�G���s��TWISTED_TEST_GTK_VERSIONz4.0,3.0�,rNF)�ReactorAlreadyRunning)�ReactorBuilder)�SkipTest�TestCasez0GObject Introspection `gi` module not importable)z3.0z4.0zUnknown GTK version: )rc��eZdZdZ						dd�Zdd�Zeee�dd��Z	eee�dd��Z
dd�Zdd�Zdd�Z
dd	�Zy
)
�GApplicationRegistrationTestsa
    GtkApplication and GApplication are supported by
    L{twisted.internet.gtk3reactor} and L{twisted.internet.gireactor}.

    We inherit from L{ReactorBuilder} in order to use some of its
    reactor-running infrastructure, but don't need its test-creation
    functionality.
    c�����t|d�std��g�d	��fd��d
���fd�}|jd|�|j��j	|�tj|��|j�ddg�y)z�
        Register the app, run the reactor, make sure app was activated, and
        that reactor was running, and that reactor can be stopped.
        �quitz Version of PyGObject is too old.c�H���jd��j�y)N�stopped)�append�stop)�reactor�results��rr$z6GApplicationRegistrationTests.runReactor.<locals>.stopRs����M�M�)�$��L�L�N�c�L���jd��jd��y)N�	activatedr)r#�	callLater)�widgetr%r&r$s ���r�activatez:GApplicationRegistrationTests.runReactor.<locals>.activateVs����M�M�+�&����a��&r'r,r)r"N��return�None)r+�objectr.r/)�hasattrr�connect�hold�registerGApplicationr�
runReactor�assertEqual)�self�appr%r,r&r$s  ` @@rr5z(GApplicationRegistrationTests.runReactorDsx����s�F�#��=�>�>���	�	'�	���J��)�	���
��$�$�S�)��!�!�$��0�����+�y�!9�:r'c��d�|_|j�}tjdtjj
��}|j
||�y)zR
        L{Gio.Application} instances can be registered with a gireactor.
        c�.�tjd��S�NF)�useGtk�r	�	GIReactor�r'r�<lambda>zIGApplicationRegistrationTests.test_gApplicationActivate.<locals>.<lambda>j���i�&9�&9��&G�r'�!com.twistedmatrix.trial.gireactor��application_id�flagsN)�reactorFactory�buildReactorr�Application�ApplicationFlags�
FLAGS_NONEr5�r7r%r8s   r�test_gApplicationActivatez7GApplicationRegistrationTests.test_gApplicationActivatefsK��H����#�#�%���o�o�>��&�&�1�1�
��
	
����W�%r'c�^�ddlm}m}m}|j	|t
j�|j	|t
j�|j	|t
j�|j�}|jt|�d�|jd|dd�y)z�
        L{twisted.internet.gtk3reactor} is now just a set of compatibility
        aliases for L{twisted.internet.GIReactor}.
        r)�Gtk3Reactor�PortableGtk3Reactor�install�z+twisted.internet.gtk3reactor was deprecated�messageN)�twisted.internet.gtk3reactorrNrOrP�assertIsr	r>�PortableGIReactor�
flushWarningsr6�len�assertIn)r7rNrOrP�warningss     r�test_gtkAliasesz-GApplicationRegistrationTests.test_gtkAliasesss���	
�	
�	
�
�
�k�9�#6�#6�7��
�
�)�9�+F�+F�G��
�
�g�y�0�0�1��%�%�'������X���*��
�
�9�8�A�;�y�;Q�	
r'c���tj|_|j�}t	j
dtjj��}|j||�y)zT
        L{Gtk.Application} instances can be registered with a gtk3reactor.
        z#com.twistedmatrix.trial.gtk3reactorrCN)
r	r>rFrGrrHrrIrJr5rKs   r�test_gtkApplicationActivatez9GApplicationRegistrationTests.test_gtkApplicationActivate�sP��
(�1�1����#�#�%���o�o�@��&�&�1�1�
��	
����W�%r'c���tj|_|j�}t	j
dtjj��}|jt|j|�y)zo
        L{gireactor.PortableGIReactor} doesn't support application
        registration at this time.
        rBrCN)r	rUrFrGrrHrIrJ�assertRaises�NotImplementedErrorr4rKs   r�
test_portablez+GApplicationRegistrationTests.test_portable�s[��
(�9�9����#�#�%���o�o�>��&�&�1�1�
��	
���-�w�/K�/K�S�Qr'c���d�|_|j�}t�}|jt|j
|�}|j
|jdjd��y)zp
        Older versions of PyGObject lack C{Application.quit}, and so won't
        allow registration.
        c�.�tjd��Sr;r=r?r'rr@z;GApplicationRegistrationTests.test_noQuit.<locals>.<lambda>�rAr'rzApplication registration is notN)	rFrGr0r^�RuntimeErrorr4�
assertTrue�args�
startswith)r7r%r8�excs    r�test_noQuitz)GApplicationRegistrationTests.test_noQuit�s\��
H����#�#�%���h������g�.J�.J�C�P����������.�.�/P�Q�Rr'c�����d��_�j��tjdtjj
���d���fd�}�j
d|�tj���y)zp
        It is not possible to register a C{Application} after the reactor has
        already started.
        c�.�tjd��Sr;r=r?r'rr@zIGApplicationRegistrationTests.test_cantRegisterAfterRun.<locals>.<lambda>�rAr'rBrCc����jt�j��}�j|jdd��j�y)Nrz5Can't register application after reactor was started.)r^rr4r6rer$)rgr8r%r7s ���r�tryRegisterzLGApplicationRegistrationTests.test_cantRegisterAfterRun.<locals>.tryRegister�sI����#�#�%�w�'C�'C�S��C�
��������T�
�
�L�L�Nr'rNr-)	rFrGrrHrIrJr*rr5)r7rlr8r%s` @@r�test_cantRegisterAfterRunz7GApplicationRegistrationTests.test_cantRegisterAfterRun�sc���
H����#�#�%���o�o�>��&�&�1�1�
��
	�	���!�[�)��!�!�$��0r'c��d�|_|j�}tjdtjj
��}|j
|�tjdtjj
��}|jt|j|�}|j|jdd�y)zN
        It is not possible to register more than one C{Application}.
        c�.�tjd��Sr;r=r?r'rr@zFGApplicationRegistrationTests.test_cantRegisterTwice.<locals>.<lambda>�rAr'rBrCz"com.twistedmatrix.trial.gireactor2rz2Can't register more than one application instance.N)rFrGrrHrIrJr4r^rcr6re)r7r%r8�app2rgs     r�test_cantRegisterTwicez4GApplicationRegistrationTests.test_cantRegisterTwice�s���H����#�#�%���o�o�>��&�&�1�1�
��	�$�$�S�)����?��&�&�1�1�
������g�.J�.J�D�Q������H�H�Q�K�M�	
r'N)r8zGio.Applicationr%zgireactor.GIReactorr.r/r-)�__name__�
__module__�__qualname__�__doc__r5rLr�	noGtkSkip�noGtkMessagerZr\r`rhrmrqr?r'rrr:sz��� ;�
� ;�%� ;�
�	 ;�D&��I�|�$�
�%�
�(�I�|�$�
&�%�
&�R�
S�1�0
r'r)rrr.r)$ru�
__future__r�unittestr�
gi.repositoryr�
giImported�osr�girr�twisted.internetr	r�join�get�split�errorMessage�
actualVersion�
gtkVersion�ImportError�twisted.internet.errorr�#twisted.internet.test.reactormixinsr�twisted.trial.unittestrr�skiprv�reprrwrrr?r'r�<module>r�s����#��N�!�
�J��8�*���9�9��"�w�{�{�#=�y�I�O�O�PS�T���L�
)��/�M�"/�";���J�9�>�5��=�D�
�4�
�F�Z�~�%E�	�&�t�J�'7�&8�9���!�^
�N�H�^
��Y���J��J��s�B8�8	C�C

Zerion Mini Shell 1.0