a  ze@s^ddlmZddlZddlZddlmZGdddZejeejd\Z Z e dkrZe dS) )utilN)supportc@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)ParentModuleTestsc CsvtddV}tj|gd(|d}|dtjWdn1sJ0YWdn1sh0YdS)N pkg.__init__ pkg.module meta_pathpkg)r mock_spec import_state __import__assertInsysmodules)selfmockmoduler]/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/import_/test_packages.pytest_import_parent s z$ParentModuleTests.test_import_parentc Cstd}tj|gdT|t}|dWdn1sF0Y||jjdWdn1st0YWdn1s0YdS)Nrrr ) rr r assertRaises ImportErrorr assertEqual exceptionname)rrcmrrrtest_bad_parents   (z!ParentModuleTests.test_bad_parentc Csdd}tjddd|id}|tj|gd|t|dWdn1s\0Y|dtj| dtj|t|dWdn1s0Y|dtj| dtjWdn1s0YWdn1s0YdS)NcSsddl}dddS)Nr)Z pkg.module)r rrr__init__szMParentModuleTests.test_raising_parent_after_importing_child..__init__rrr Z module_coder) rr r rZeroDivisionErrorr assertNotInrrrrrrrrr)test_raising_parent_after_importing_childs ( (z;ParentModuleTests.test_raising_parent_after_importing_childc Csdd}tjddd|id}|tj|gd|ttf|dWdn1s`0Y|dtj |ttf|dWdn1s0Y|dtj Wdn1s0YWdn1s0YdS)NcSsddlm}dddS)Nrrr)rr%rrrr*s zVParentModuleTests.test_raising_parent_after_relative_importing_child..__init__rrr r r rr r rr!rr r"rrr#rrr2test_raising_parent_after_relative_importing_child)s((zDParentModuleTests.test_raising_parent_after_relative_importing_childc Csdd}tjdddd|id}|tj|gd|ttf|dWdn1sb0Y|dtj |ttf|dWdn1s0Y|dtj Wdn1s0YWdn1s0YdS) NcSsddlm}dddS)Nrr%rr)Zsubpkgrr%rrrr=s z]ParentModuleTests.test_raising_parent_after_double_relative_importing_child..__init__rzpkg.subpkg.__init__zpkg.subpkg.modulez pkg.subpkgr rr'r#rrr9test_raising_parent_after_double_relative_importing_child<s((zKParentModuleTests.test_raising_parent_after_double_relative_importing_childcCsH|t}|dWdn1s*0Y||jjddS)Nzsys.no_submodules_here)rrr rrr)rrrrrtest_module_not_packagePs (z)ParentModuleTests.test_module_not_packagec sd}|dfdd}tjdd|id}|d}tj|gd6z|}Wtn t0Wdn1sz0YWdn1s0YdS)Nmodz.bcsdtj<dS)Nz total bunk)rrrZsubnamerrmodule_injection\szTParentModuleTests.test_module_not_package_but_side_effects..module_injectionr r)rr r r rZunload)rrr-r rZ submodulerr,r(test_module_not_package_but_side_effectsWs  z:ParentModuleTests.test_module_not_package_but_side_effectsN) __name__ __module__ __qualname__rrr$r(r)r*r.rrrrrsr)r __main__) r&rrZunittesttestrrZ test_bothr ZFrozen_ParentTestsZSource_ParentTestsr/mainrrrrs  c