Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_modulefinder.cpython-310.opt-1.pyc

o

0�i�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,kr�e�%�dSdS)-�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�|�Wnty&}z
|jtjkr�WYd}~nd}~wwt|d�S)N�wb)�os�path�dirname�makedirs�OSError�errnoZEEXIST�open)rr�e�r�=/opt/alt/python310/lib64/python3.10/test/test_modulefinder.py�	open_file%s���
r cCs�d}zM|��D]=}t|�tkr|�d�}|�d�s|�d�r(|�|��d�q|r.|��t|�tkr9|�d�}t	t
j�t
|����}qW|rN|��dSdS|rW|��ww)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|
�z=|t||d�}|�|�|r|��tt|��}t|j�}|�||�|��\}
}|�|
|�|�||	�Wt	�
t�dSt	�
t�w)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_testcC�|�t�dS�N)r@�package_test�r;rrr�test_package`�zModuleFinderTest.test_packagecCrArB)r@�
maybe_testrDrrr�
test_maybecrFzModuleFinderTest.test_maybecCrArB)r@�maybe_test_newrDrrr�test_maybe_newfrFzModuleFinderTest.test_maybe_newcCrArB)r@�absolute_import_testrDrrr�test_absolute_importsirFz&ModuleFinderTest.test_absolute_importscCrArB)r@�relative_import_testrDrrr�test_relative_importslrFz&ModuleFinderTest.test_relative_importscCrArB)r@�relative_import_test_2rDrrr�test_relative_imports_2orFz(ModuleFinderTest.test_relative_imports_2cCrArB)r@�relative_import_test_3rDrrr�test_relative_imports_3rrFz(ModuleFinderTest.test_relative_imports_3cCrArB)r@�relative_import_test_4rDrrr�test_relative_imports_4urFz(ModuleFinderTest.test_relative_imports_4cCrArB)r@�syntax_error_testrDrrr�test_syntax_errorxrFz"ModuleFinderTest.test_syntax_errorcCrArB)r@�same_name_as_bad_testrDrrr�test_same_name_as_bad{rFz&ModuleFinderTest.test_same_name_as_badcCs�tj�td�}|tjjd}|tjjd}t|��}|�	d�
d��Wd�n1s.wYtj||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�n1s*wY|��}d||f}|�	||�dS)Nrz	module.pyzspam.py�)r3r4zco_filename %r changed to %r)
rrr-r.rZcaptured_stdoutr@rG�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_opargscCrArB)r@�coding_default_utf8_testrDrrr�test_coding_default_utf8�rFz)ModuleFinderTest.test_coding_default_utf8cCrArB)r@�coding_explicit_utf8_testrDrrr�test_coding_explicit_utf8�rFz*ModuleFinderTest.test_coding_explicit_utf8cCrArB)r@�coding_explicit_cp1252_testrDrrr�test_coding_explicit_cp1252�rFz,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|��dSrB)�super�__init__)r;�args�kwds��	__class__rrrv�szJModuleFinderTest.test_load_module_api.<locals>.CheckLoadModuleApi.__init__cs|\}}}t��||||�SrB)ru�load_module)r;Zfqname�fp�pathname�	file_info�suffix�moder%ryrrr{�s
zMModuleFinderTest.test_load_module_api.<locals>.CheckLoadModuleApi.load_module)�__name__�
__module__�__qualname__rvr{�
__classcell__rrryr�CheckLoadModuleApi�sr�)r=)�modulefinder�ModuleFinderr@rK)r;r�rrr�test_load_module_api�s	z%ModuleFinderTest.test_load_module_apiN)r�r�r�r�r�r@rErHrJrLrNrPrRrTrVrXrfrkrnrprrrtr�rrrrr2As&


r2�__main__)&rr�importlib.machineryrZr^r:ZunittestZtempfile�testrr�Zmkdtempr.rr�__file__r5rGrIrCrKrMrOrQrSrarUrWrorqr'rsr r1ZTestCaser2r��mainrrrr�<module>s�����!�%	�(��
�	������
s�