
    Yf                         d Z ddlZddlmZ ddlmZ  G d de          Z	 ddlmZ	 e	Zn# e
$ r dZY nw xY wdZedZ G d	 d
e          ZdS )z&
Tests for twisted.internet.glibbase.
    N)ensureNotImported)TestCasec                   *    e Zd ZdZd Zd Zd Zd ZdS )EnsureNotImportedTestszQ
    L{ensureNotImported} protects against unwanted past and future imports.
    c                     i }|                      t          d|           t          ddgdg 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   s     U/var/www/html/env/lib/python3.11/site-packages/twisted/internet/test/test_glibbase.pytest_ensureWhenNotImportedz1EnsureNotImportedTests.test_ensureWhenNotImported   se     

3	7+++4,EWEWEWXXXXT"F"FGGGGG    c                     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   s     r   %test_ensureWhenNotImportedDontPreventz<EnsureNotImportedTests.test_ensureWhenNotImportedDontPrevent   sO    
 

3	7+++4,555"%%%%%r   c                     ddi}|                      t          d|           t          ddgdddg           |                     |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   s     r   test_ensureWhenFailedToImportz4EnsureNotImportedTests.test_ensureWhenFailedToImport)   sd    
 ,

3	7+++4,dD\RRRRT":":;;;;;r   c                    t                      }d|i}|                     t          d|           |                     t          t
          ddgdddg          }|                     |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   es       r   test_ensureFailsWhenImportedz3EnsureNotImportedTests.test_ensureFailsWhenImported3   s    
 .

3	7+++4L $<  
 
 	4.11111111r   N)__name__
__module____qualname____doc__r   r   r   r#    r   r   r   r      s]         	H 	H 	H& & &< < <2 2 2 2 2r   r   )	gireactorzgi reactor not availablec                       e Zd ZdZeZd ZdS )GlibReactorBaseTestsz
    Tests for the private C{twisted.internet._glibbase.GlibReactorBase}
    done via the public C{twisted.internet.gireactor.PortableGIReactor}
    c                     t                               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   suts     r   test_simulatez"GlibReactorBaseTests.test_simulateZ   sG     )))77dCKKMM***r   N)r$   r%   r&   r'   missingGlibReactorskipr3   r(   r   r   r+   r+   R   s4         
 D
 
 
 
 
r   r+   )r'   r   twisted.internet._glibbaser   twisted.trial.unittestr   r   twisted.internetr)   
_gireactorr   r4   r+   r(   r   r   <module>r:      s    
 


 8 8 8 8 8 8 + + + + + +42 42 42 42 42X 42 42 42n888888 II    III
  3    8     s   + 55