CasperSecurity

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

o

�b8�@s�dZddlZddlmZddlmZmZddlmZddl	m
ZGdd�de�ZGd	d
�d
e�Z
Gdd�de�ZGd
d�de�ZdS)z&
Tests for L{twisted.python.runtime}.
�N)�namedModule)�Platform�shortPythonVersion)�SynchronousTestCase)�suppressc@seZdZdZdd�ZdS)�PythonVersionTestsz.
    Tests the shortPythonVersion method.
    cCs8t��d�}td�D]}|�t||�tj|�q
dS)zE
        Verify if the Python version is returned correctly.
        �.�N)r�split�range�assertEqual�int�sys�version_info)�self�ver�i�r�B/usr/lib/python3/dist-packages/twisted/python/test/test_runtime.py�test_shortPythonVersions�z*PythonVersionTests.test_shortPythonVersionN)�__name__�
__module__�__qualname__�__doc__rrrrrrsrc@s\eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	e
eed
�ge	_dd�Z
dd�ZdS)�
PlatformTestsz8
    Tests for the default L{Platform} initializer.
    zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.cCst�}|�|���dS)z�
        L{Platform.isKnown} returns a boolean indicating whether this is one of
        the L{runtime.knownPlatforms}.
        N)r�
assertTrue�isKnown�r�platformrrr�test_isKnown)szPlatformTests.test_isKnowncCs@t�}|��r|�|���|�|���|�|���dSdS)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�isMacOSXrrrr�test_isVistaConsistency1s�z%PlatformTests.test_isVistaConsistencycCs&t�}|��r|�|��d�dSdS)zq
        L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
        returns C{'posix'}.
        �posixN)rr$r�getTyperrrr�test_isMacOSXConsistency<s�z&PlatformTests.test_isMacOSXConsistencycCs(t�}|��r|�tj�d��dSdS)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�isLinuxrrr�
startswithrrrr�test_isLinuxConsistencyEs�z%PlatformTests.test_isLinuxConsistencycCs8t�}|��}|�|d�|��dkr|�|�dSdS)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!�assertInr'r#)rrr!rrr�test_isWinNTNs�zPlatformTests.test_isWinNT)�category�messagecCsFt�}|��|�|jg�}|�t|�d�|�|dd|j�dS)zV
        L{Platform.isWinNT} is deprecated in favor of L{platform.isWindows}.
        �rr1N)rr!�
flushWarnings�test_isWinNTDeprecatedr�len�isWinNTDeprecationMessage)rr�warningsrrrr4`s
z$PlatformTests.test_isWinNTDeprecatedcCsFztd�Wnty|�t����YdSw|�t����dS)z�
        L{Platform.supportsThreads} returns C{True} if threads can be created in
        this runtime, C{False} otherwise.
        �	threadingN)r�ImportErrorr#r�supportsThreadsr�rrrr�test_supportsThreadsjs�z"PlatformTests.test_supportsThreadsN)rrrrr6rr%r(r,r/�SUPRESS�DeprecationWarningrr4r<rrrrrs �		��
rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ForeignPlatformTestszD
    Tests for L{Platform} based overridden initializer values.
    cCsT|�td���d�|�td���d�|�td���d�|�td���d�dS)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.
        �ntr-�cer&�javaN)rrr'r;rrr�test_getTypesz!ForeignPlatformTests.test_getTypecCs@|�tdd����|�tdd����|�tdd����dS)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�linux2r-)rrr$r#r;rrr�
test_isMacOSX�sz"ForeignPlatformTests.test_isMacOSXcCsh|�tdd����|�tdd����|�tdd����|�tdd����|�tdd����dS)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.
        NrDr)rE�linux3r-)r#rr*rr;rrr�test_isLinux�s
z!ForeignPlatformTests.test_isLinuxN)rrrrrCrFrHrrrrr?zs

r?c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�DockerPlatformTestsz@
    Tests for L{twisted.python.runtime.Platform.isDocker}.
    cCstdd�}|�|���dS)zV
        If the platform is not Linux, C{isDocker()} always returns L{False}.
        Nr-�rr#�isDockerrrrr�test_noChecksOnLinux�s
z(DockerPlatformTests.test_noChecksOnLinuxcCs tdd�}|�|jdd��dS)z�
        If the platform is Linux, and the cgroups file in C{/proc} does not
        exist, C{isDocker()} returns L{False}
        Nr)�fakepath��_initCGroupLocationrJrrrr�test_noCGroups�s
z"DockerPlatformTests.test_noCGroupscC�\|��}t|d��
}|�d�Wd�n1swYtdd�}|�|j|d��dS)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/104155a6453cb67590027e397dc90fc25a06a7508403c797bc89ea43adf8d35fNr)rN)�mktemp�open�writerrrK�r�cgroupsFile�frrrr�test_cgroupsSuggestsDocker�s��
z.DockerPlatformTests.test_cgroupsSuggestsDockercCrQ)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}.
        rRsy9:perf_event:/
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/systemNr)rN)rSrTrUrr#rKrVrrr�test_cgroupsSuggestsRealSystem�s��
z2DockerPlatformTests.test_cgroupsSuggestsRealSystemN)rrrrrLrPrYrZrrrrrI�srI)rr�twisted.python.reflectr�twisted.python.runtimerr�twisted.trial.unittestr�twisted.trial.utilrr=rrr?rIrrrr�<module>s['
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY