Your IP : 216.73.216.85


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_modulefinder.cpython-39.opt-1.pyc

a

XC?h�0�@s�ddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
Z
e��Zeej
�ej�gZdgd�dgdgdgZdgd�dgdgd	gZdgd
�ddggdgZdgd
�ddggdgZdgd�ggdgZdgd�ggdgZdddgdggdgZdddgggdgZddgggdgZdgd�dggdgZdgd�dggdgZdddgggd gZdddgggd!gZd"d"dgggd#d$�d%�gZd&d'�Z d(d)�Z!Gd*d+�d+ej"�Z#e$d,k�r�e�%�dS)-�N)�support�a.module)�ar�sys�b�czb.somethingz�a/__init__.py
a/module.py
                                from b import something
                                from c import something
b/__init__.py
                                from sys import *
)rrrr�
__future__aa/__init__.py
a/module.py
                                from b import something
                                from c import something
b/__init__.py
                                from __future__ import absolute_import
                                from sys import *
)r�a.bza.crZmymodulerZblahblahamymodule.py
a/__init__.py
                                import blahblah
                                from a import b
                                import c
a/module.py
                                import sys
                                from a import b as x
                                from a.c import sillyname
a/b.py
a/c.py
                                from a.module import x
                                import mymodule as sillyname
                                from sys import version_info
)	rrrzb.xzb.yzb.zrr�gc�zajmymodule.py
a/__init__.py
a/module.py
                                from __future__ import absolute_import
                                import sys # sys
                                import blahblah # fails
                                import gc # gc
                                import b.x # b.x
                                from b import y # b.y
                                from b.z import * # b.z.*
a/gc.py
a/sys.py
                                import mymodule
a/b/__init__.py
a/b/x.py
a/b/y.py
a/b/z.py
b/__init__.py
                                import z
b/unused.py
b/x.py
b/y.py
b/z.py
)rrrr	�a.b.y�a.b.z�a.b.c�
a.b.c.moduleC�a.b.c.d�a.b.c.e�a.b.xr
a�mymodule.py
a/__init__.py
                                from .b import y, z # a.b.y, a.b.z
a/module.py
                                from __future__ import absolute_import # __future__
                                import gc # gc
a/gc.py
a/sys.py
a/b/__init__.py
                                from ..b import x # a.b.x
                                #from a.b.c import moduleC
                                from .c import moduleC # a.b.moduleC
a/b/x.py
a/b/y.py
a/b/z.py
a/b/g.py
a/b/c/__init__.py
                                from ..c import e # a.b.c.e
a/b/c/moduleC.py
                                from ..c import d # a.b.c.d
a/b/c/d.py
a/b/c/e.py
a/b/c/x.py
)
rrza.sysr	rr
rrrrza.b.c.frz	a.anothera�mymodule.py
a/__init__.py
                                from . import sys # a.sys
a/another.py
a/module.py
                                from .b import y, z # a.b.y, a.b.z
a/gc.py
a/sys.py
a/b/__init__.py
                                from .c import moduleC # a.b.c.moduleC
                                from .c import d # a.b.c.d
a/b/x.py
a/b/y.py
a/b/z.py
a/b/c/__init__.py
                                from . import e # a.b.c.e
a/b/c/moduleC.py
                                #
                                from . import f   # a.b.c.f
                                from .. import x  # a.b.x
                                from ... import another # a.another
a/b/c/d.py
a/b/c/e.py
a/b/c/f.py
rza.barz�a/__init__.py
                                def foo(): pass
a/module.py
                                from . import foo
                                from . import bar
zza/__init__.py
                                def foo(): pass
a/module.py
                                from . import *
�)rrrzb.modulez�a/__init__.py
a/module.py
                                import b.module
b/__init__.py
b/module.py
                                ?  # SyntaxError: invalid syntax
)rrrzb.cz�a/__init__.py
a/module.py
                                import c
                                from b import c
b/__init__.py
b/c.py
Za_utf8Zb_utf8u�a_utf8.py
                                # use the default of utf8
                                print('Unicode test A code point 2090 ₐ that is not valid in cp1252')
                                import b_utf8
b_utf8.py
                                # use the default of utf8
                                print('Unicode test B code point 2090 ₐ that is not valid in cp1252')
uza_utf8.py
                                # coding=utf8
                                print('Unicode test A code point 2090 ₐ that is not valid in cp1252')
                                import b_utf8
b_utf8.py
                                # use the default of utf8
                                print('Unicode test B code point 2090 ₐ that is not valid in cp1252')
Za_cp1252s�a_cp1252.py
                                # coding=cp1252
                                # 0xe2 is not allowed in utf8
                                print('CP1252 test P�t�')
                                import b_utf8
u�b_utf8.py
                                # use the default of utf8
                                print('Unicode test A code point 2090 ₐ that is not valid in cp1252')
�utf-8c
CsXtj�|�}zt�|�Wn2tyL}z|jtjkr8�WYd}~n
d}~00t|d�S)N�wb)�os�path�dirname�makedirs�OSError�errnoZEEXIST�open)rr�e�r�;/opt/alt/python39/lib64/python3.9/test/test_modulefinder.py�	open_file%sr cCs�d}z�|��D]z}t|�tkr(|�d�}|�d�s<|�d�rP|�|��d�q|r\|��t|�tkrr|�d�}t	t
j�t
|����}qW|r�|��n|r�|��0dS)Nr� �	�
)�
splitlines�type�bytes�encode�
startswith�write�strip�close�decoder rr�join�TEST_DIR)�sourceZofi�linerrr�create_package/s 


�r1c@s�eZdZddgejfdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�ModuleFinderTestFrc	Cs�|\}}}}	}
t|
�zx|t||d�}|�|�|r<|��tt|��}t|j�}|�||�|��\}
}|�|
|�|�||	�Wt	�
t�nt	�
t�0dS)N)r�debug�
replace_paths)r1�	TEST_PATHZimport_hook�report�sorted�set�modulesZassertEqualZany_missing_maybe�shutilZrmtreer.)�self�infor6r3r4�modulefinder_classZimport_thisr9ZmissingZ
maybe_missingr/Zmf�foundZbad�mayberrr�_do_testBs �


zModuleFinderTest._do_testcCs|�t�dS�N)r@�package_test�r;rrr�test_package`szModuleFinderTest.test_packagecCs|�t�dSrA)r@�
maybe_testrCrrr�
test_maybecszModuleFinderTest.test_maybecCs|�t�dSrA)r@�maybe_test_newrCrrr�test_maybe_newfszModuleFinderTest.test_maybe_newcCs|�t�dSrA)r@�absolute_import_testrCrrr�test_absolute_importsisz&ModuleFinderTest.test_absolute_importscCs|�t�dSrA)r@�relative_import_testrCrrr�test_relative_importslsz&ModuleFinderTest.test_relative_importscCs|�t�dSrA)r@�relative_import_test_2rCrrr�test_relative_imports_2osz(ModuleFinderTest.test_relative_imports_2cCs|�t�dSrA)r@�relative_import_test_3rCrrr�test_relative_imports_3rsz(ModuleFinderTest.test_relative_imports_3cCs|�t�dSrA)r@�relative_import_test_4rCrrr�test_relative_imports_4usz(ModuleFinderTest.test_relative_imports_4cCs|�t�dSrA)r@�syntax_error_testrCrrr�test_syntax_errorxsz"ModuleFinderTest.test_syntax_errorcCs|�t�dSrA)r@�same_name_as_bad_testrCrrr�test_same_name_as_bad{sz&ModuleFinderTest.test_same_name_as_badcCs�tj�td�}|tjjd}|tjjd}t|�� }|�	d�
d��Wd�n1s\0Ytj||d�t�
|�|�t�dS)Nrrztesting_modulefinder = True
r)�cfile)rrr-r.�	importlib�	machinery�SOURCE_SUFFIXES�BYTECODE_SUFFIXESr r)r'�
py_compile�compile�remover@�
bytecode_test)r;�	base_path�source_path�
bytecode_path�filerrr�
test_bytecode~s
.
zModuleFinderTest.test_bytecodecCs�tj�tdd�}tj�tdd�}t���&}|jtd||fgd�Wd�n1sT0Y|��}d||f}|�	||�dS)Nrz	module.pyzspam.py�)r3r4zco_filename %r changed to %r)
rrr-r.rZcaptured_stdoutr@rE�getvalueZassertIn)r;Zold_path�new_path�outputZexpectedrrr�test_replace_paths�s
�$z#ModuleFinderTest.test_replace_pathscCs,dddgggdttd��g}|�|�dS)NrrzVa.py
                                %r
                                import b
b.py
i)�list�ranger@)r;Zextended_opargs_testrrr�test_extended_opargs�s
��
z%ModuleFinderTest.test_extended_opargscCs|�t�dSrA)r@�coding_default_utf8_testrCrrr�test_coding_default_utf8�sz)ModuleFinderTest.test_coding_default_utf8cCs|�t�dSrA)r@�coding_explicit_utf8_testrCrrr�test_coding_explicit_utf8�sz*ModuleFinderTest.test_coding_explicit_utf8cCs|�t�dSrA)r@�coding_explicit_cp1252_testrCrrr�test_coding_explicit_cp1252�sz,ModuleFinderTest.test_coding_explicit_cp1252cCs$Gdd�dtj�}|jt|d�dS)Ncs(eZdZ�fdd�Z�fdd�Z�ZS)zAModuleFinderTest.test_load_module_api.<locals>.CheckLoadModuleApicst�j|i|��dSrA)�super�__init__)r;�args�kwds��	__class__rrrt�szJModuleFinderTest.test_load_module_api.<locals>.CheckLoadModuleApi.__init__cs|\}}}t��||||�SrA)rs�load_module)r;Zfqname�fp�pathname�	file_info�suffix�moder%rwrrry�s
zMModuleFinderTest.test_load_module_api.<locals>.CheckLoadModuleApi.load_module)�__name__�
__module__�__qualname__rtry�
__classcell__rrrwr�CheckLoadModuleApi�sr�)r=)�modulefinder�ModuleFinderr@rI)r;r�rrr�test_load_module_api�s	z%ModuleFinderTest.test_load_module_apiN)rr�r�r�r�r@rDrFrHrJrLrNrPrRrTrVrdrirlrnrprrr�rrrrr2As$


r2�__main__)&rr�importlib.machineryrXr\r:ZunittestZtempfile�testrr�Zmkdtempr.rr�__file__r5rErGrBrIrKrMrOrQr_rSrUrmror'rqr r1ZTestCaser2r�mainrrrr�<module>s�����!�%	�(��
�	�������
s