asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYhF@sddlZddlZddlZddlZddlZddlZddlmZddlm Z ddl Z ddl Z e $e deddlZWdn1s0YddlZddZGddde jZGd d d e jZGd d d e jZGd dde jZGddde jZedkre dS)N)support) script_helperignorecCs"t|}tttd d|S)N load_dynamiczimp.load_dynamic() required)r cpython_onlyunittestskipIfhasattrimp)methr )/usr/local/lib/python3.9/test/test_imp.pyrequires_load_dynamics  rc@seZdZddZddZdS) LockTestscCs|t|d|dS)Nz!expected imp.lock_held() to be %r) assertEqualr lock_held)selfexpectedr r r verify_lock_states zLockTests.verify_lock_statecCsd}t}||t|D]}t|dqt|D] }tq>|||sz tWntyxYn 0|ddS)N2Tz5release_lock() without lock should raise RuntimeError)r rrrange acquire_lock release_lock RuntimeErrorZfail)rZLOOPSZlock_held_at_startir r r testLock s        zLockTests.testLockN)__name__ __module__ __qualname__rrr r r r rsrc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ e ddZ e ddZ e ddZe ddZe ddZeejdddZddZd d!Zejd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,S)- ImportTestscCstd}|j|_|j|_dS)Nztest.encoded_modules) importlib import_module test_strings__path__ test_path)rmodr r r setUp<s zImportTests.setUpcCs2|jD]&\}}}td|}|||jqdS)Nztest.encoded_modules.module_)r"r r!rtest)rmodnameencodingZteststrr%r r r test_import_encoded_moduleAs z&ImportTests.test_import_encoded_modulec Cs|jD]N\}}}td||jd}||j|Wdq1sJ0Yqtjt g}| t td|Wdn1s0YdS)Nmodule_rbadsyntax_pep3120) r"r find_moduler$rr)ospathdirname__file__ assertRaises SyntaxError)rr%r)_fdr/r r r test_find_module_encodingGs . z%ImportTests.test_find_module_encodingc Cs|jD]\}}}td||j\}}}|N||d||j|||d||d|Wdq1s0Yqtd\}}}|J||d||jd||d||dWdn1s0YdS)Nr+rz# test %s encoding tokenizeutf-8z*"""Tokenization help for Python programs. ) r"r r-r$ZassertNotEqualrr)tellreadline)rr%r)r4fpfilenameinfor r r test_issue1267Ps&    &  zImportTests.test_issue1267c Csd}tjddzt|dd}|dWdn1sB0Yt|\}}}|||j dWtjd=t |dt |dn&tjd=t |dt |d0dS) NZtest_imp_helperr..pywz%# coding: cp1252 u = 'test.test_imp' cp1252.pyc) sysr/insertopenwriter r-closerr)runlink)r temp_mod_namefiler<r=r r r test_issue3594cs(zImportTests.test_issue3594c CsVt}ddddddddddd }tjdkr>||dd }n ||}|sZ|d |||}d |}d |}tj |d }ztj dtj t |dd}| dWdn1s0Yt|\}} } ||||| dd||| dd|| dd|| dtjt||| | } || jdWdn1sl0Yt*tdt||d} Wdn1s0Y|| jdt8tdtjst|t|d} Wdn1s0Y|| jdtj|s@t|t |d}| dWdn1sl0Yt&tdt||} Wdn1s0Y|| j dWtjd=dD]"} t!"|| t!"|| qt!#|t!#dnFtjd=dD]"} t!"|| t!"|| qt!#|t!#d0dS)Nsä) r8cp1250cp1251rBcp1253cp1254cp1255cp1256cp1257cp1258darwinr8säz2can't run this test with %s as filesystem encodingZtest_imp_helper_Ztest_imp_helper_package_z __init__.pyrr@rAza = 1 rrzb = 2 )r@rC __pycache__)$rDgetfilesystemencodingplatformrgetskipTestdecoder.r/joinrEcurdirrFrGr r-ZassertIsNotNoneZ assertTrueendswithZ PY_SOURCE load_moduleawarningscatch_warnings simplefilter load_sourcedont_write_bytecodeZ load_compiledcache_from_sourceexistsmkdirZ load_packagebrrIrmtree)rZ fs_encodingZ known_localesZ special_charZ decoded_charrJZtest_package_nameZinit_file_namerKr<r=r%packageextr r r test_issue5604qs    ( .  0   $  *  ,   zImportTests.test_issue5604cCs$tjt}|ttjd|gdS)Nr,)r.r/r0r1r2r3r r-)rr/r r r test_issue9319s  zImportTests.test_issue9319cCstj}tj}tdtd}||djtj dg|R}| t|| ||j| ||jWdn1s~0YdS)Nr.r) r.r/getenvrEnvironmentVarGuardr r- addCleanuprHrgassertIsZ assertIsNot)r orig_pathZ orig_getenvxZnew_osr r r test_load_from_sources    z!ImportTests.test_load_from_sourcecCsNd}t|}|d}|dur*||jtj|g|R}||j|dS)N_heapqr)r r-ryrHrgrr)rZexampler|Zfile_r%r r r test_issue15828_load_extensionss  z+ImportTests.test_issue15828_load_extensionscCsd}t|\}}}|t||}td|}td|}||j|||jd||jd|ttd|Wdn1s0YdS)N_testimportmultipleZ_testimportmultiple_fooZ_testimportmultiple_barZ nonexistent)r r-rHrrrr2 ImportError)rmfileobjpathname descriptionZmod0Zmod1Zmod2r r r +test_issue16421_multiple_modules_in_one_dlls    z7ImportTests.test_issue16421_multiple_modules_in_one_dllcCsbd}d}|t}t||Wdn1s40Y|||jj|||jjdS)Nzbogus file path extension) r2rr rZassertIn exceptionr/rname)rr/rerrr r r "test_load_dynamic_ImportError_paths  *z.ImportTests.test_load_dynamic_ImportError_pathcCsbd}t|}|ddur&|d|ddtjkrB|dtj|dg|ddRdS)Nrrr]z/found module doesn't appear to be a C extensionr[)r r-rHZ C_EXTENSIONrbrg)rrfoundr r r 'test_load_module_extension_file_is_Nones    z3ImportTests.test_load_module_extension_file_is_NonecCsd}z tj|=Wnty"Yn0zt|}tjd}t||j }| |j || |j j || |j j |j |tt|d| |jd|tj||Wz tj|=WqtyYq0n"z tj|=WntyYn00dS)Nztest.imp_dummyZ_testmultiphaseZ dummy_namei)rDmodulesKeyErrorr r!util find_specr roriginrr__spec__rr2AttributeErrorgetattrZ int_constrz)rrmodulespecr r r 3test_issue24748_load_module_skips_sys_modules_checks.        z?ImportTests.test_issue24748_load_module_skips_sys_modules_checkz*test meaningful only when writing bytecodecCsXt<tjd}t||tdtjtjdgWdn1sJ0YdS)Nr@z ^No moduler?) rtemp_cwdZTESTFNr.rpassertRaisesRegexrr r-)rsourcer r r test_bug7732+s     zImportTests.test_bug7732cCs2tdtjttj}|tj|tjdS)Nr )r Z_LoadSourceCompatibilityr1rFget_data)rloaderr r r test_multiple_calls_to_get_data4s   z+ImportTests.test_multiple_calls_to_get_datac Csdt}ttjt|}ttj||L|td t |t dWdn1s`0YWdn1s~0YdS)Ntmpz embedded null) rtyperDrrZ swap_itemr ValueErrorr rlr1)rr(r%r r r test_load_source;s  zImportTests.test_load_sourcecCsRttd}Gddd}|t||Wdn1sD0YdS)Ncreate_dynamicc@seZdZdZdZdS)z,ImportTests.test_issue31315..BadSpecNfoo)rrrrrr r r r BadSpecIsr)rZ get_attributer r2 TypeError)rrrr r r test_issue31315Ds  zImportTests.test_issue31315cCs4ddl}||jjdddl}||jjddS)Nrfrozen)_frozen_importlib_externalrrr_frozen_importlib)rrrr r r test_issue_35321OszImportTests.test_issue_35321cCs,|tddd|tddddS)N*shisZ :}+s659)r_imp source_hash)rr r r test_source_hashZszImportTests.test_source_hashcCshgdfddgdfddgdfddgdfg}|D]6\}}|ddg}tj|}||jd|q,dS)Ndefaultz--check-hash-based-pycsalwaysneverz-cz.import _imp; print(_imp.check_hash_based_pycs)r8)rZassert_python_okroutstriprc)rZcasesZ interp_argsrargsresr r r 'test_pyc_invalidation_mode_from_cmdline^s     z3ImportTests.test_pyc_invalidation_mode_from_cmdlinec Cst~tdd}|dWdn1s40Ytjddtjjdtj ddgd\}}}t d|||}Wdn1s0Y| |j d dS) Nzmymod.pywbsx = 42 T)doraiseinvalidation_modeZmymodr?)r/r) rrrFrG py_compilecompilePycInvalidationMode CHECKED_HASHr r-rgrr|)rr;rKr/rr%r r r test_find_and_load_checked_pycms  (.z*ImportTests.test_find_and_load_checked_pycN)rrrr&r*r6r>rLrurvr}rrrrrrrrrDrmrrrrrrrrrrr r r r r;s< W         rc@s,eZdZddZddZddZddZd S) ReloadTestscCs>t"ddl}t|Wdn1s00YdS)Nr)rrxr.r reload)rr.r r r test_sources zReloadTests.test_sourcecCs@td"ddl}t|Wdn1s20YdS)Ntimer)r CleanImportrr r)rrr r r test_extensions zReloadTests.test_extensioncCs@td"ddl}t|Wdn1s20YdS)Nmarshalr)rrrr r)rrr r r test_builtins zReloadTests.test_builtincshddlm}tjdfdd}|||tdt |Wdn1sZ0YdS)Nr)parserhtmlcstjd<dS)Nr)rDrr rr r cleanupsz5ReloadTests.test_with_deleted_parent..cleanup) rrrDrpopryrrr r)rrrr rr test_with_deleted_parents     z$ReloadTests.test_with_deleted_parentN)rrrrrrrr r r r r|s rc@sLeZdZeZeej j dudddZ eej j dudddZ dS) PEP3147TestsNz1requires sys.implementation.cache_tag not be Nonec CsFtjdddd}tjddddd|j}|t|d|dS)Nrbarbazqux.pyr^ qux.{}.pycT)r.r/rdformattagrr rnrr/expectr r r test_cache_from_sources  z#PEP3147Tests.test_cache_from_sourcez4requires sys.implementation.cache_tag to not be Nonec CsDtjddddd|j}tjdddd}|t||dS)Nrrrr^rr)r.r/rdrrrr source_from_cacherr r r test_source_from_caches  z#PEP3147Tests.test_source_from_cache) rrrr Zget_tagrrZ skipUnlessrDimplementation cache_tagrrr r r r rs rc@s&eZdZeejdudddZdS)NullImporterTestsNzNeed an undecodeable filenamec Cs@tj}t|z|ttj|Wt|n t|0dS)N) rTESTFN_UNENCODABLEr.rpr2rr Z NullImporterrmdir)rrr r r test_unencodeables  z#NullImporterTests.test_unencodeable)rrrrrrrrr r r r rs r__main__)r importlib.utilr.Zos.pathrrDr'rZ test.supportrrrirjrkDeprecationWarningr rrZTestCaserrrrrrmainr r r r s.    &"C&