o
    >h                     @   s   d Z ddlZddlmZ ddlmZ G dd deZzddlmZ	 W n e
y-   dZY nw e	ZdZedu r8dZG d	d
 d
eZdS )z&
Tests for twisted.internet.glibbase.
    N)ensureNotImported)TestCasec                   @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )EnsureNotImportedTestszQ
    L{ensureNotImported} protects against unwanted past and future imports.
    c                 C   s@   i }|  td| tddgdg dd | |dddd dS )z
        If the specified modules have never been imported, and import
        prevention is requested, L{ensureNotImported} makes sure they will not
        be imported in the future.
        modulesm1m2
A message.)r   r   m3preventImportsNpatchsysr   assertEqualselfr    r   /var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/twisted/internet/test/test_glibbase.pytest_ensureWhenNotImported   s   z1EnsureNotImportedTests.test_ensureWhenNotImportedc                 C   s0   i }|  td| tddgd | |i  dS )z
        If the specified modules have never been imported, and import
        prevention is not requested, L{ensureNotImported} has no effect.
        r   r   r   r   Nr   r   r   r   r   %test_ensureWhenNotImportedDontPrevent   s   z<EnsureNotImportedTests.test_ensureWhenNotImportedDontPreventc                 C   sB   ddi}|  td| tddgdddgd | |ddd dS )z
        If the specified modules have been set to L{None} in C{sys.modules},
        L{ensureNotImported} does not complain.
        r   Nr   r   r   r
   )r   r   r   r   r   r   r   test_ensureWhenFailedToImport)   s   z4EnsureNotImportedTests.test_ensureWhenFailedToImportc                 C   sZ   t  }d|i}| td| | jttddgdddgd}| |d|i | |jd dS )z
        If one of the specified modules has been previously imported,
        L{ensureNotImported} raises an exception.
        r   r   r   r   r
   )r   N)objectr   r   assertRaisesImportErrorr   r   args)r   moduler   er   r   r   test_ensureFailsWhenImported3   s   z3EnsureNotImportedTests.test_ensureFailsWhenImportedN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r      s    

r   )	gireactorzgi reactor not availablec                   @   s   e Zd ZdZeZdd ZdS )GlibReactorBaseTestsz
    Tests for the private C{twisted.internet._glibbase.GlibReactorBase}
    done via the public C{twisted.internet.gireactor.PortableGIReactor}
    c                 C   s(   t jdd}| d|  |  dS )z
        C{simulate} can be called without raising any errors when there are
        no delayed calls for the reactor and hence there is no defined sleep
        period.
        F)useGtkN)r"   PortableGIReactorassertIstimeoutsimulate)r   sutr   r   r   test_simulateZ   s   z"GlibReactorBaseTests.test_simulateN)r   r   r    r!   missingGlibReactorskipr*   r   r   r   r   r#   R   s    r#   )r!   r   twisted.internet._glibbaser   twisted.trial.unittestr   r   twisted.internetr"   
_gireactorr   r+   r#   r   r   r   r   <module>   s   7