+
    üÐjƒ  ã                   ó`   € R t ^ RIt^ RIHt ^ RIHt  ! R R4      tR tR t ! R R	]4      t	R# )
zt
Tests for miscellaneous behaviors of the top-level L{twisted} package (ie, for
the code in C{twisted/__init__.py}.
N)Ú
ModuleType)ÚTestCasec                   ó<   a € ] tR t^t o RtR tR tR tR tRt	V t
R# )ÚSetAsideModulezŽ
L{SetAsideModule} is a context manager for temporarily removing a module
from C{sys.modules}.

@ivar name: The name of the module to remove.
c                ó   € Wn         R # ©N)Úname)Úselfr   s   &&Ú;/usr/lib/python3/dist-packages/twisted/test/test_twisted.pyÚ__init__ÚSetAsideModule.__init__   s   € ØŽ	ó    c                ó.  € \        \        P                  P                  4       4       UUu/ uFA  w  r#W P                  8X  g+   VP                  V P                  R,           4      '       g   K?  W#bKC  	  pppV F  p\        P                  V K  	  V# u uppi )z�
Find the given module and all of its hierarchically inferior modules in
C{sys.modules}, remove them from it, and return whatever was found.
Ú.)ÚlistÚsysÚmodulesÚitemsr   Ú
startswith)r	   r   Ú
moduleNameÚmoduler   s   &&   r
   Ú	_unimportÚSetAsideModule._unimport   s   € ô )-¬S¯[©[×->Ñ->Ó-@Ô(Aô
á(AÑ$�ØŸi™iÔ'¨:×+@Ñ+@ÀÇÁÈSÅ×+Qô ˆJÒÙ(Að 	ñ 
ó
 ˆDÜ—‘˜DÒ!ñ àˆùó
s   «<BÁ,Bc                óF   € V P                  V P                  4      V n        R # r   )r   r   r   )r	   s   &r
   Ú	__enter__ÚSetAsideModule.__enter__+   s   € Ø—~‘~ d§i¡iÓ0ˆŽr   c                óŽ   € V P                  V P                  4       \        P                  P	                  V P                  4       R # r   )r   r   r   r   Úupdate)r	   ÚexcTypeÚexcValueÚ	tracebacks   &&&&r
   Ú__exit__ÚSetAsideModule.__exit__.   s(   € Ø�‰�t—y‘yÔ!Ü�‰×Ñ˜4Ÿ<™<Ö(r   )r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r!   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r
   r   r      s#   ø‡ € ñòòò1÷)ð )r   r   c                ó`   € / p\        RW4       \        P                  P                  V4       R# )a¤  
Take a mapping defining a package and turn it into real C{ModuleType}
instances in C{sys.modules}.

Consider these example::

    a = {"foo": "bar"}
    b = {"twisted": {"__version__": "42.6"}}
    c = {"twisted": {"plugin": {"getPlugins": stub}}}

C{_install(a)} will place an item into C{sys.modules} with C{"foo"} as the
key and C{"bar" as the value.

C{_install(b)} will place an item into C{sys.modules} with C{"twisted"} as
the key.  The value will be a new module object.  The module will have a
C{"__version__"} attribute with C{"42.6"} as the value.

C{_install(c)} will place an item into C{sys.modules} with C{"twisted"} as
the key.  The value will be a new module object with a C{"plugin"}
attribute.  An item will also be placed into C{sys.modules} with the key
C{"twisted.plugin"} which refers to that module object.  That module will
have an attribute C{"getPlugins"} with a value of C{stub}.

@param modules: A mapping from names to definitions of modules.  The names
    are native strings like C{"twisted"} or C{"unittest"}.  Values may be
    arbitrary objects.  Any value which is not a dictionary will be added to
    C{sys.modules} unmodified.  Any dictionary value indicates the value is
    a new module and its items define the attributes of that module.  The
    definition of this structure is recursive, so a value in the dictionary
    may be a dictionary to trigger another level of processing.

@return: L{None}
N)Ú_makePackagesr   r   r   )r   Úresults   & r
   Ú_installr/   3   s&   € ðD €FÜ�$˜Ô(Ü‡K�K×Ñ�vÖr   c                ó  € / p\        VP                  4       4       Fß  w  rEV fS   \        V\        4      '       d7   \	        V4      pVP
                  P                  \        WeV4      4       WbV&   KU  WRV&   K[  \        V\        4      '       dk   \	        V P                  R,           V,           4      pVP
                  P                  \        WeV4      4       WbV P                  R,           V,           &   WcV&   KÛ  WSV&   Ká  	  V# )a›  
Construct module objects (for either modules or packages).

@param parent: L{None} or a module object which is the Python package
    containing all of the modules being created by this function call.  Its
    name will be prepended to the name of all created modules.

@param attributes: A mapping giving the attributes of the particular module
    object this call is creating.

@param result: A mapping which is populated with all created module names.
    This is suitable for use in updating C{sys.modules}.

@return: A mapping of all of the attributes created by this call.  This is
    suitable for populating the dictionary of C{parent}.

@see: L{_install}.
r   )	r   r   Ú
isinstanceÚdictr   Ú__dict__r   r-   r#   )ÚparentÚ
attributesr.   Úattrsr   Úvaluer   s   &&&    r
   r-   r-   Z   sÏ   € ð& €EÜ˜J×,Ñ,Ó.Ö/‰ˆØŠ>Ü˜%¤×&Ò&Ü# DÓ)�Ø—‘×&Ñ&¤}°VÀFÓ'KÔLØ%�t“à$�t“ä˜%¤×&Ò&Ü# F§O¡O°cÕ$9¸DÕ$@ÓA�Ø—‘×&Ñ&¤}°VÀFÓ'KÔLØ7=�v—‘¨Õ,¨tÕ3Ñ4Ø$�d“à#�d“ñ 0ð  €Lr   c                   ó6   a € ] tR t^�t o RtR tR tR tRtV t	R# )ÚMakePackagesTestsz\
Tests for L{_makePackages}, a helper for populating C{sys.modules} with
fictional modules.
c                óp   € / p\        R\        RR7      V4       V P                  V\        RR7      4       R# )zy
A non-C{dict} value in the attributes dictionary passed to L{_makePackages}
is preserved unchanged in the return value.
NÚreactor)r;   )r-   r2   ÚassertEqual©r	   r   s   & r
   Útest_nonModuleÚ MakePackagesTests.test_nonModule‡   s/   € ð
 ˆÜ�dœD¨Ô3°WÔ=Ø×Ñ˜¤$¨yÔ"9Ö:r   c           	     ó>  € / p\        R\        \        RR7      R7      V4       V P                  V\        4       V P                  VR,          \        4       V P	                  RVR,          P
                  4       V P	                  RVR,          P                  4       R# )z±
A C{dict} value in the attributes dictionary passed to L{_makePackages}
is turned into a L{ModuleType} instance with attributes populated from
the items of that C{dict} value.
NÚ123©Úversion©ÚtwistedrE   )r-   r2   ÚassertIsInstancer   r<   r#   rC   r=   s   & r
   Útest_moduleWithAttributeÚ*MakePackagesTests.test_moduleWithAttribute�   sz   € ð ˆÜ�dœD¬°eÔ)<Ô=¸wÔGØ×Ñ˜g¤tÔ,Ø×Ñ˜g iÕ0´*Ô=Ø×Ñ˜ G¨IÕ$6×$?Ñ$?Ô@Ø×Ñ˜ ¨	Õ 2× :Ñ :Ö;r   c                ó  € / p\        R\        \        \        RR7      R7      R7      V4       V P                  V\        4       V P                  VR,          \        4       V P	                  RVR,          P
                  4       V P                  VR,          P                  \        4       V P	                  RVR,          P                  P
                  4       V P	                  RVR,          P                  P                  4       R# )z�
Processing of the attributes dictionary is recursive, so a C{dict} value
it contains may itself contain a C{dict} value to the same effect.
NÚ321rB   )ÚwebrD   rE   ztwisted.web)r-   r2   rF   r   r<   r#   rK   rC   r=   s   & r
   Útest_packageWithModuleÚ(MakePackagesTests.test_packageWithModule�   sÁ   € ð
 ˆÜ�dœD¬´$¸uÔ2EÔ)FÔGÈÔQØ×Ñ˜g¤tÔ,Ø×Ñ˜g iÕ0´*Ô=Ø×Ñ˜ G¨IÕ$6×$?Ñ$?Ô@Ø×Ñ˜g iÕ0×4Ñ4´jÔAØ×Ñ˜¨°	Õ(:×(>Ñ(>×(GÑ(GÔHØ×Ñ˜ ¨	Õ 2× 6Ñ 6× >Ñ >Ö?r   © N)
r#   r$   r%   r&   r'   r>   rG   rL   r(   r)   r*   s   @r
   r9   r9   �   s    ø‡ € ñò
;ò<÷@ð @r   r9   )
r'   r   Útypesr   Útwisted.trial.unittestr   r   r/   r-   r9   rN   r   r
   Ú<module>rQ      s:   ðñó Ý å +÷
)ñ )òB$òN$ôN(@˜ö (@r   