%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f���r�dZddlZddlmZddlmZmZddlmZm	Z	ddl
mZGd�dej�Z
y)	z#
Tests for L{twisted.names.cache}.
�N)�verifyClass)�
interfaces�task)�cache�dns)�unittestc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�CachingTestsz+
    Tests for L{cache.CacheResolver}.
    c�T�ttjtj�y)zK
        L{cache.CacheResolver} implements L{interfaces.IResolver}
        N)rr�	IResolverr�
CacheResolver)�selfs �?/usr/lib/python3/dist-packages/twisted/names/test/test_cache.py�test_interfacezCachingTests.test_interfaces��	�J�(�(�%�*=�*=�>�c��tjtjdtjtj
��t
j�gggffi�}|jd�j|jgggf�S)N�example.com��name�type�cls)
rr
r�Query�MX�IN�time�lookupMailExchange�addCallback�assertEqual)r�cs  r�test_lookupzCachingTests.test_lookupsx������	�	�~�C�F�F����G��I�I�K���R�L�J�
�
���#�#�N�3�?�?����r�2�r�l�
�	
rc�V�tjdtjtjdtjdd��gtjdtjtjdtjdd��gtjdtjtjdtjdd��gf}tj�}tjdtjtj��}tj||j�|fi|��}|jd�|j||j�|j|jd�tj�S)z�
        Cache entries passed into L{cache.CacheResolver.__init__} get
        cancelled just like entries added with cacheResult
        r�<�	127.0.0.1�2�(r��reactor)r�RRHeader�Ar�Record_Ar�Clockrrr
�seconds�advance�assertNotIn�
assertFailure�
lookupAddress�DomainError)r�r�clock�queryrs     r�test_constructorExpiresz$CachingTests.test_constructorExpires*s*�����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
�
��$�
�
����	�	�~�C�E�E�s�v�v�F����������!�(<� =�u�M��	�
�
�b���������(��!�!�!�/�/�.�"A�3�?�?�S�Src���tjdtjtjdtjdd��gtjdtjtjdtjdd��gtjdtjtjdtjdd��gf}tj�}tj|��}|jtjdtjtj��|�|jd��fd	�}|jd�j|�S)
z�
        When a cache lookup finds a cached entry from 1 second ago, it is
        returned with a TTL of original TTL minus the elapsed 1 second.
        rr"r#r$r%r&r�c�*���j|ddjd��j|ddjd��j|ddjd��j|ddjjd�y)Nr�;r7�1��'r)r�ttlr)�resultrs �r�cbLookupz0CachingTests.test_normalLookup.<locals>.cbLookupls�������V�A�Y�q�\�-�-�r�2����V�A�Y�q�\�-�-�r�2����V�A�Y�q�\�-�-�r�2����V�A�Y�q�\�.�.�3�3�^�Dr)rr(r)rr*rr+rr
�cacheResultrr-r0r)rr2r3rr?s`    r�test_normalLookupzCachingTests.test_normalLookupNs������"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
�
��$�
�
�������.��	�
�
�c�i�i�^�#�%�%�S�V�V�L�a�P�
�
�
�a��	E����~�.�:�:�8�D�Drc�T�tjdtjtjdtjdd��gtjdtjtjdtjdd��gtjdtjtjdtjdd��gf}tj�}tj|��}tjdtjtj��}|j||�|jd�|j||j�|j|jd�tj�S)zW
        Once the TTL has been exceeded, the result is removed from the cache.
        rr"r#r$r%r&r)rr(r)rr*rr+rr
rr@r-r.r/r0r1)rr2r3rr4s     r�test_cachedResultExpiresz%CachingTests.test_cachedResultExpirests$�����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
�
��$�
�
�������.���	�	�~�C�E�E�s�v�v�F��	�
�
�e�Q��
�
�
�b���������(��!�!�!�/�/�.�"A�3�?�?�S�Src�*�tjdtjtjdtjdd��gtjdtjtjdtjdd��gtjdtjtjdtjdd��gf}tj�}d�|_tjtjdtjtj��|j�|fi|��}|jd	�|j|jd�tj�S)
z�
        When the cache is queried exactly as the cached entry should expire but
        before it has actually been cleared, the cache does not return the
        expired entry.
        rr"r#r$r%c��y)N�)�args�kwargss  r�<lambda>z4CachingTests.test_expiredTTLLookup.<locals>.<lambda>�s�rrr&g�����N@)rr(r)rr*rr+�	callLaterrr
rr,r-r/r0r1)rr2r3rs    r�test_expiredTTLLookupz"CachingTests.test_expiredTTLLookup�s%�����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
����"�C�E�E�3�6�6�2�s�|�|�K�QS�7T��
�
��$�
�
���6�������	�	�~�C�E�E�s�v�v�F��M�M�O��I�
��
��	�
�
�d���!�!�!�/�/�.�"A�3�?�?�S�SrN)
�__name__�
__module__�__qualname__�__doc__rr r5rArCrKrFrrr
r
s,���?�
�"T�H$E�L T�D(Trr
)rOr�zope.interface.verifyr�twisted.internetrr�
twisted.namesrr�
twisted.trialr�TestCaser
rFrr�<module>rUs1���
�-�-�$�"�lT�8�$�$�lTr

Zerion Mini Shell 1.0