CasperSecurity

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

o

�b��@s�dZddlmZzddlmZWneydZYnweZddlmZddlm	Z
ddlmZddl
mZmZd	d
�Z	dd�Zd
d�ZGdd�de�ZdS)z(
Tests for L{twisted.python._tzhelper}.
�)�environ)�tzsetN)�	timedelta)�mktime)�FixedOffsetTimeZone)�SkipTest�TestCasecCs(zt|�WStytd|����w)z�
    Call L{mktime_real}, and if it raises L{OverflowError}, catch it and raise
    SkipTest instead.

    @param t9: A time as a 9-item tuple.
    @type t9: L{tuple}

    @return: A timestamp.
    @rtype: L{float}
    z(Platform cannot construct time zone for )�mktime_real�
OverflowErrorr)�t9�r�C/usr/lib/python3/dist-packages/twisted/python/test/test_tzhelper.pyrs

�rcCsDtdurdS|durztd=Wn
tyYnw|td<t�dS)zR
    Set time zone.

    @param name: a time zone name
    @type name: L{str}
    N�TZ)rr�KeyError)�namerrr
�setTZ.s
�
rcs"t�dd��|j�fdd��}dS)z�
    Add cleanup hooks to a test case to reset timezone to original value.

    @param testCase: the test case to add the cleanup to.
    @type testCase: L{unittest.TestCase}
    rNcst��dS)N)rr��tzInrr
�resetTZKszaddTZCleanup.<locals>.resetTZ)r�get�
addCleanup)�testCaserrrr
�addTZCleanupBsrc@seZdZdZdd�ZdS)�FixedOffsetTimeZoneTestsz+
    Tests for L{FixedOffsetTimeZone}.
    csXtdurtd���fdd�}t��|ddd�|ddd	�|d
dd�|d
dd�dS)z�
        Test that timezone attributes respect the timezone as set by the
        standard C{TZ} environment variable and L{tzset} API.
        Nz:Platform cannot change timezone; unable to verify offsets.cs�t|�td�}td�}t�|�}t�|�}��|�|�d|�����|�|�d|�����|�|�td����|�|�td��dd�}��|�|�||����|�|�||��dS)N)	i���rrr���)	i�r�rrr�rr�UTCrcSsft|�dksJ�|d}t|dd��}t|dd��}|dkr'|}|}n|dks-J�t||d�S)N�rr��-�+)�hours�minutes)�len�intr)�offset�signr&r'rrr
�timeDeltaFromOffsetlszZFixedOffsetTimeZoneTests.test_tzinfo.<locals>.testForTimeZone.<locals>.timeDeltaFromOffset)	rrr�fromLocalTimeStamp�assertEqual�tzname�dstr�	utcoffset)r�expectedOffsetDST�expectedOffsetSTD�localDST�localSTD�tzDST�tzSTDr,��selfrr
�testForTimeZone]s 

��z=FixedOffsetTimeZoneTests.test_tzinfo.<locals>.testForTimeZonezUTC+00z+0000zEST+05EDT,M4.1.0,M10.5.0z-0400z-0500zCEST-01CEDT,M4.1.0,M10.5.0z+0200z+0100zCST+06z-0600)rrr)r9r:rr8r
�test_tzinfoUs%z$FixedOffsetTimeZoneTests.test_tzinfoN)�__name__�
__module__�__qualname__�__doc__r;rrrr
rPsr)r?�osr�timer�_tzset�ImportError�datetimerrr	�twisted.python._tzhelperr�twisted.trial.unittestrrrrrrrrr
�<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