%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����dZddlZddlmZddlmZmZddlmZddl	m
ZGd�de�ZGd	�d
e�Z
Gd�de�ZGd
�de�Zy)z&
Tests for L{twisted.python.runtime}.
�N)�namedModule)�Platform�shortPythonVersion)�SynchronousTestCase)�suppressc��eZdZdZdd�Zy)�PythonVersionTestsz.
    Tests the shortPythonVersion method.
    Nc��t�jd�}td�D]1}|jt	||�t
j|��3y)zE
        Verify if the Python version is returned correctly.
        �.�N)r�split�range�assertEqual�int�sys�version_info)�self�ver�is   �B/usr/lib/python3/dist-packages/twisted/python/test/test_runtime.py�test_shortPythonVersionz*PythonVersionTests.test_shortPythonVersionsM��!�"�(�(��-���q��	?�A����S��Q��[�#�*:�*:�1�*=�>�	?���returnN)�__name__�
__module__�__qualname__�__doc__r�rrr	r	s���?rr	c�l�eZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Z	e
ee�	�ge	_dd
�Z
dd�Zy)
�
PlatformTestsz8
    Tests for the default L{Platform} initializer.
    zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.Nc�V�t�}|j|j��y)z�
        L{Platform.isKnown} returns a boolean indicating whether this is one of
        the L{runtime.knownPlatforms}.
        N)r�
assertTrue�isKnown�r�platforms  r�test_isKnownzPlatformTests.test_isKnown)s ��
�:������(�(�*�+rc���t�}|j�r^|j|j��|j|j	��|j|j
��yy)z�
        Verify consistency of L{Platform.isVista}: it can only be C{True} if
        L{Platform.isWinNT} and L{Platform.isWindows} are C{True}.
        N)r�isVistar#�isWinNT�	isWindows�assertFalse�isMacOSXr%s  r�test_isVistaConsistencyz%PlatformTests.test_isVistaConsistency1s]��
�:�������O�O�H�,�,�.�/��O�O�H�.�.�0�1����X�.�.�0�1�rc�z�t�}|j�r!|j|j�d�yy)zq
        L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
        returns C{'posix'}.
        �posixN)rr-r�getTyper%s  r�test_isMacOSXConsistencyz&PlatformTests.test_isMacOSXConsistency<s5��
�:���������X�-�-�/��9�rc��t�}|j�r/|jtjjd��yy)z�
        L{Platform.isLinux} can only return C{True} if L{Platform.getType}
        returns C{'posix'} and L{sys.platform} starts with C{"linux"}.
        �linuxN)r�isLinuxr#rr&�
startswithr%s  r�test_isLinuxConsistencyz%PlatformTests.test_isLinuxConsistencyEs7��
�:�������O�O�C�L�L�3�3�G�<�=�rc��t�}|j�}|j|d�|j�dk7r|j	|�yy)z�
        L{Platform.isWinNT} can return only C{False} or C{True} and can not
        return C{True} if L{Platform.getType} is not C{"win32"}.
        )FT�win32N)rr*�assertInr1r,)rr&r*s   r�test_isWinNTzPlatformTests.test_isWinNTNsK��
�:���"�"�$���
�
�g�}�-������(����W�%�)r)�category�messagec���t�}|j�|j|jg�}|j	t|�d�|j	|dd|j�y)zV
        L{Platform.isWinNT} is deprecated in favor of L{platform.isWindows}.
        �rr=N)rr*�
flushWarnings�test_isWinNTDeprecatedr�len�isWinNTDeprecationMessage)rr&�warningss   rrAz$PlatformTests.test_isWinNTDeprecated`sc���:�������%�%�t�'B�'B�&C�D������X���*�����!��Y�/��1O�1O�Prc���	td�|jt�j��y#t$r*|jt�j��YywxYw)z�
        L{Platform.supportsThreads} returns C{True} if threads can be created in
        this runtime, C{False} otherwise.
        �	threadingN)rr#r�supportsThreads�ImportErrorr,�rs r�test_supportsThreadsz"PlatformTests.test_supportsThreadsjsR��	:���$�
�O�O�H�J�6�6�8�9���	;����X�Z�7�7�9�:�	;�s�5�0A(�'A(r)rrrrrCr'r.r2r7r;�SUPRESS�DeprecationWarningrrArJrrrr!r!sP���
	F��
,�	2�:�>�	&�	�'�-�	
��L��Q�
:rr!c�(�eZdZdZdd�Zdd�Zdd�Zy)�ForeignPlatformTestszD
    Tests for L{Platform} based overridden initializer values.
    Nc�L�|jtd�j�d�|jtd�j�d�|jtd�j�d�|jtd�j�d�y)z�
        If an operating system name is supplied to L{Platform}'s initializer,
        L{Platform.getType} returns the platform type which corresponds to that
        name.
        �ntr9�cer0�javaN)rrr1rIs r�test_getTypez!ForeignPlatformTests.test_getTypesz��	
����$��/�/�1�7�;�����$��/�/�1�7�;�����'�*�2�2�4�g�>�����&�)�1�1�3�V�<rc��|jtdd�j��|jtdd�j��|jtdd�j��y)z�
        If a system platform name is supplied to L{Platform}'s initializer, it
        is used to determine the result of L{Platform.isMacOSX}, which returns
        C{True} for C{"darwin"}, C{False} otherwise.
        N�darwin�linux2r9)r#rr-r,rIs r�
test_isMacOSXz"ForeignPlatformTests.test_isMacOSX�s\��	
�����x�0�9�9�;�<�����$��1�:�:�<�=�����$��0�9�9�;�<rc��|jtdd�j��|jtdd�j��|jtdd�j��|jtdd�j��|jtdd�j��y)z�
        If a system platform name is supplied to L{Platform}'s initializer, it
        is used to determine the result of L{Platform.isLinux}, which returns
        C{True} for values beginning with C{"linux"}, C{False} otherwise.
        NrUr4rV�linux3r9)r,rr5r#rIs r�test_isLinuxz!ForeignPlatformTests.test_isLinux�s���	
����$��1�9�9�;�<������w�/�7�7�9�:������x�0�8�8�:�;������x�0�8�8�:�;�����$��0�8�8�:�;rr)rrrrrSrWrZrrrrNrNzs���	=�=�
<rrNc�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�DockerPlatformTestsz@
    Tests for L{twisted.python.runtime.Platform.isDocker}.
    Nc�Z�tdd�}|j|j��y)zV
        If the platform is not Linux, C{isDocker()} always returns L{False}.
        Nr9�rr,�isDockerr%s  r�test_noChecksOnLinuxz(DockerPlatformTests.test_noChecksOnLinux�s'���D�'�*������*�*�,�-rc�^�tdd�}|j|jd���y)z�
        If the platform is Linux, and the cgroups file in C{/proc} does not
        exist, C{isDocker()} returns L{False}
        Nr4�fakepath��_initCGroupLocationr^r%s  r�test_noCGroupsz"DockerPlatformTests.test_noCGroups�s,��
�D�'�*������*�*�z�*�J�Krc���|j�}t|d�5}|jd�ddd�tdd�}|j	|j|���y#1swY�7xYw)z�
        If the platform is Linux, and the cgroups file (faked out here) exists,
        and one of the paths starts with C{/docker/}, C{isDocker()} returns
        C{True}.
        �wbsd10:debug:/
9:net_prio:/
8:perf_event:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
7:net_cls:/
6:freezer:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
5:devices:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
4:blkio:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
3:cpuacct:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
2:cpu:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35f
1:cpuset:/docker/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35fNr4rc)�mktemp�open�writerr#r_�r�cgroupsFile�fr&s    r�test_cgroupsSuggestsDockerz.DockerPlatformTests.test_cgroupsSuggestsDocker�sj���k�k�m��
�+�t�
$�
	��
�G�G�	U�
�
	��D�'�*������)�)�k�)�J�K�!
	�
	���A%�%A.c���|j�}t|d�5}|jd�ddd�tdd�}|j	|j|���y#1swY�7xYw)z�
        If the platform is Linux, and the cgroups file (faked out here) exists,
        and none of the paths starts with C{/docker/}, C{isDocker()} returns
        C{False}.
        rgsy9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/systemNr4rc)rhrirjrr,r_rks    r�test_cgroupsSuggestsRealSystemz2DockerPlatformTests.test_cgroupsSuggestsRealSystem�sk���k�k�m��
�+�t�
$�	��
�G�G��

�	��D�'�*������*�*�{�*�K�L�	�	�ror)rrrrr`rernrqrrrr\r\�s���.�L�L�2Mrr\)rr�twisted.python.reflectr�twisted.python.runtimerr�twisted.trial.unittestr�twisted.trial.utilrrKr	r!rNr\rrr�<module>rvsW���
�.�?�6�2�?�,�?�X:�'�X:�v$<�.�$<�NCM�-�CMr

Zerion Mini Shell 1.0