a  ze@sddlmZddlmZedZddlZddlZddlZeej j dudGdddej Z ej e ed \Z Zeej j dudGd d d Zej eed \ZZed kredS) )abc)utilzimportlib.machineryNzno reasonable builtin modulec@sPeZdZddZddZddZddZd ZZd Z d d Z d d Z ddZ d S) LoaderTestscCsdd|jjd|_dS)Nerrno)__name__ __package__ __loader__) machineryBuiltinImporter verification)selfr[/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/builtin/test_loader.pysetUpszLoaderTests.setUpcCsH||tj|jD]\}}|t|||q||jt j dSN) ZassertIsInstancetypes ModuleTyper items assertEqualgetattrZassertInrsysmodules)rmoduleattrvaluerrrverifyszLoaderTests.verifycCs|jj|Sr)r r load_module)rnamerrrrszLoaderTests.load_modulecCsJttjj(|tjj}||Wdn1s<0YdSr)runcacheBUILTINS good_namerr)rrrrr test_moduleszLoaderTests.test_moduleNcCsZttjj8|tjj}|tjj}|||Wdn1sL0YdSr)rr r!r"rZassertIs)rZmodule1Zmodule2rrrtest_module_reuse)szLoaderTests.test_module_reusecCsLd}|t}||Wdn1s.0Y||jj|dS)NZ dssdsdfff) assertRaises ImportErrorrr exceptionr)rrcmrrrtest_unloadable0s (zLoaderTests.test_unloadablecCsd}t|$t|}|tj|<Wdn1s80Y|t}||Wdn1sl0Y| |j j |dS)NZbuiltin_reload_test) rr rrrrr%r&rrr'r)r module_namerr(rrrtest_already_imported7s  ( (z!LoaderTests.test_already_imported) r __module__ __qualname__rrrr#Z test_packageZtest_lacking_parentZtest_state_after_failurer$r)r+rrrrr sr)r c@s@eZdZddZddZddZeej j dudd d Z dS) InspectLoaderTestscCs |jjtjj}||dSr)r r get_coderr!r" assertIsNonerresultrrr test_get_codeNsz InspectLoaderTests.test_get_codecCs |jjtjj}||dSr)r r get_sourcerr!r"r0r1rrrtest_get_sourceSsz"InspectLoaderTests.test_get_sourcecCs |jjtjj}||dSr)r r is_packagerr!r"Z assertFalser1rrrtest_is_packageXsz"InspectLoaderTests.test_is_packageNzall modules are built incCsRdD]}t|jj|}q|t}|tjjWdn1sD0YdS)N)r/r4r6)rr r r%r&rr!bad_name)rZ meth_namemethodr(rrrtest_not_builtin]s z#InspectLoaderTests.test_not_builtin) rr,r-r3r5r7unittestskipIfrr!r8r:rrrrr.Is r.__main__)rrrZimport_importlibr rrr;r<r!r"rZ test_bothZFrozen_LoaderTestsZSource_LoaderTestsr.ZFrozen_InspectLoaderTestsZSource_InspectLoaderTestsrmainrrrrs"   ;