a  ze@sddlmZedZedZedZedZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlZddlZddlZddlZGd d d Zejeed\ZZGd d d Zejeeeed \ZZGdddZejeed\ZZGdddZejeed\ZZGdddZ eje ed\Z!Z"GdddZ#eje#ed\Z$Z%GdddZ&eje&eeed\Z'Z(GdddZ)eje)ed\Z*Z+GdddZ,eje,ed\Z-Z.Gdddej/Z)e0dkre1dS))utilz importlib.abc importlibzimportlib.machineryzimportlib.utilN)supportc@s(eZdZdZddZddZddZdS) DecodeSourceBytesTestsu string ='ü'cCs&|jd}||j||jdS)Nutf-8sourceencode assertEqualr decode_source)self source_bytesrQ/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/test_util.pytest_ut8_defaults z'DecodeSourceBytesTests.test_ut8_defaultcCs,d|j}|d}||j||dS)Nz# coding=latin-1 zlatin-1rr r rrrrtest_specified_encodings  z.DecodeSourceBytesTests.test_specified_encodingcCsBd|j|jg}|d}||j|d|j|jgdS)Nz r )joinr r r rr rrrrtest_universal_newlines!s  z.DecodeSourceBytesTests.test_universal_newlinesN)__name__ __module__ __qualname__r rrrrrrrrsrc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)ModuleFromSpecTestscCsXGddd}|jd|}|t|j|}Wdn1sJ0YdS)Nc@seZdZddZdS)z9ModuleFromSpecTests.test_no_create_module..LoadercSsdSNrr modulerrr exec_module1szEModuleFromSpecTests.test_no_create_module..Loader.exec_moduleN)rrrrrrrrLoader0srtest) machinery ModuleSpec assertRaises ImportErrorrmodule_from_specr rspecrrrrtest_no_create_module/s z)ModuleFromSpecTests.test_no_create_modulecCsRGddd|jj}|jd|}|j|}||tj| |j |j dS)Nc@seZdZddZdS)zCModuleFromSpecTests.test_create_module_returns_None..LoadercSsdSrr)r r'rrr create_module9szQModuleFromSpecTests.test_create_module_returns_None..Loader.create_moduleNrrrr)rrrrr8srr ) abcrr!r"rr%assertIsInstancetypes ModuleTyper rnamer&rrrtest_create_module_returns_None7s  z3ModuleFromSpecTests.test_create_module_returns_NonecsjdGdddtjGfddd|jj}|jd|}|j|}||| |j dS)Nz already setc@s eZdZdS)z.CustomModuleN)rrrrrrr CustomModuleBsr1cseZdZfddZdS)z6ModuleFromSpecTests.test_create_module..Loadercs|j}|_|Sr)r/rr r'rr1r/rrr)Es zDModuleFromSpecTests.test_create_module..Loader.create_moduleNr*rr3rrrDsrr ) r-r.r+rr!r"rr%r,r rr&rr3rtest_create_module@s  z&ModuleFromSpecTests.test_create_modulecCs0|jdt}|j|}||j|jdSNr )r!r"objectrr%r rr/r2rrr test___name__Ns z!ModuleFromSpecTests.test___name__cCs.|jdt}|j|}||j|dSr5)r!r"r6rr%r __spec__r2rrr test___spec__Ss z!ModuleFromSpecTests.test___spec__cCs2t}|jd|}|j|}||j|dSr5)r6r!r"rr%assertIs __loader__)r loaderr'rrrrtest___loader__Xs z#ModuleFromSpecTests.test___loader__cCs0|jdt}|j|}||j|jdS)Nztest.pkg)r!r"r6rr%r __package__parentr2rrrtest___package__^s z$ModuleFromSpecTests.test___package__cCs4|jjdtdd}|j|}||j|jdS)Nr T) is_package)r!r"r6rr%r __path__submodule_search_locationsr2rrr test___path__cs z!ModuleFromSpecTests.test___path__cCs:|jjdtdd}d|_|j|}||j|jdS)Nr some/path)originT) r!r"r6 has_locationrr%r __file__rFr2rrr test___file__hs z!ModuleFromSpecTests.test___file__cCs<|jdt}d|_d|_|j|}||j|jdS)Nr rET) r!r"r6cachedrGrr%r __cached__r2rrrtest___cached__ns  z#ModuleFromSpecTests.test___cached__N) rrrr(r0r4r7r9r=r@rDrIrLrrrrr-s r)r+r!rc@sleZdZdZeddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZdS)ModuleForLoaderTestsz+Tests for importlib.util.module_for_loader.cCsDt(tdt|j|WdS1s60YdS)Nignore)warningscatch_warnings simplefilterDeprecationWarningrmodule_for_loader)clsfuncrrrrSs  z&ModuleForLoaderTests.module_for_loaderc CsrtVtdt|t |jdd}Wdn1sF0YWdn1sd0YdS)NerrorcSs|Srr)xrrrz3ModuleForLoaderTests.test_warning..)rOrPrQrRr#rrS)r rUrrr test_warnings   z!ModuleForLoaderTests.test_warningcCs|dd}|||S)NcSs|SrrrrrrrXrYz4ModuleForLoaderTests.return_module..)rS)r r/fxnrrr return_modulesz"ModuleForLoaderTests.return_modulecCs8dd}||}z|||Wnty2Yn0dS)NcSstdSr)r$rrrrto_wrapsz5ModuleForLoaderTests.raise_exception..to_wrap)rSr$)r r/r]r[rrrraise_exceptions   z$ModuleForLoaderTests.raise_exceptioncCsfd}t|(||}||tjWdn1s<0Y||tj| |j |dSNa.b.c) runcacher\assertInsysmodulesr,r-r.r r)r module_namerrrrtest_new_modules   ,z$ModuleForLoaderTests.test_new_modulecsGfddd}d}td}d|_d|_t|X|tj|<|}||} |tj| |j| |j|Wdn1s0YdS)Ncs"eZdZddZjddZdS)z4ModuleForLoaderTests.test_reload..FakeLoadercSsdS)NTrr r/rrrrAsz?ModuleForLoaderTests.test_reload..FakeLoader.is_packagecSs|Srrrrrr load_modulesz@ModuleForLoaderTests.test_reload..FakeLoader.load_moduleN)rrrrArSrhrr rr FakeLoadersrjr`*) r-r.r;r>rrarcrdrhr:r )r rjr/rr<Zreturned_modulerrir test_reloads    z ModuleForLoaderTests.test_reloadcCsJd}t|(||||tjWdn1s<0YdSr_)rrar^ assertNotInrcrdrgrrrtest_new_module_failures  z,ModuleForLoaderTests.test_new_module_failurecCsbd}t|}t|6|tj|<||||tj|Wdn1sT0YdSr_)r-r.rrarcrdr^r:r r/rrrrtest_reload_failures     z(ModuleForLoaderTests.test_reload_failurecCs6dd}||}||j|j||j|jdS)NcSsdSrrrrrrr[rYz6ModuleForLoaderTests.test_decorator_attrs..fxn)rSr rrr r[wrappedrrrtest_decorator_attrss z)ModuleForLoaderTests.test_decorator_attrscCsvGdddtj}d}||}t|:|||tj|<||}|||Wdn1sh0YdS)Nc@seZdZddZdS)z;ModuleForLoaderTests.test_false_module..FalseModulecSsdS)NFrrirrr__bool__rYzDModuleForLoaderTests.test_false_module..FalseModule.__bool__Nrrrrtrrrr FalseModulesrvmod) r-r.rraZ assertFalsercrdr\r:)r rvr/rZgivenrrrtest_false_modules    z&ModuleForLoaderTests.test_false_modulecsGfddd}d}t|L|d}||}|j||j||jdWdn1sr0Yd}t|L|d}||}|j||j||j|Wdn1s0YdS)Ncs*eZdZddZddZjddZdS)z.FakeLoadercSs ||_dSrZ_pkg)r rArrr__init__szEModuleForLoaderTests.test_attributes_set..FakeLoader.__init__cSs|jSrryrgrrrrAszGModuleForLoaderTests.test_attributes_set..FakeLoader.is_packagecSs|SrrrrrrrhszHModuleForLoaderTests.test_attributes_set..FakeLoader.load_moduleN)rrrrzrArSrhrrirrrjsrjpkg.modFpkgzpkg.subT)rrarhr rr:r;r>)r rjr/r<rrrirtest_attributes_sets   ,  z(ModuleForLoaderTests.test_attributes_setN)rrr__doc__ classmethodrSrZr\r^rfrlrnrprsrxr}rrrrrM{s    rMc@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS)SetPackageTestsz%Tests for importlib.util.set_package.cstfdd}|j|}t"tdt|Wdn1sH0Y|td||j dS)zcVerify the module has the expected value for __package__ after passing through set_package.csSrrrrrrrXrYz(SetPackageTests.verify..rNNr>) r set_packagerOrPrQrR assertTruehasattrr r>)r rexpectr[rrrrrverifys    $zSetPackageTests.verifycCs td}d|_||ddS)Nrr-r.r>rrrrrtest_top_level s zSetPackageTests.test_top_levelcCs(td}dg|_d|_||ddS)Nr|z)r-r.rBr>rrrrr test_packages zSetPackageTests.test_packagecCs td}d|_||ddS)Nr{r|rrrrrtest_submodules zSetPackageTests.test_submodulecCs.td}t|drt|d||ddS)Nrwr>r)r-r.rdelattrrrrrrtest_setting_if_missing!s   z'SetPackageTests.test_setting_if_missingcCs*dD] }td}||_|||qdS)N)TFrwr)r valuerrrrtest_leaving_alone(s z"SetPackageTests.test_leaving_alonecCsldd}t(tdt|j|}Wdn1s>0Y||j|j||j|jdS)NcSsdSrrrrrrr[0rYz1SetPackageTests.test_decorator_attrs..fxnrN) rOrPrQrRrrr rrrqrrrrs/s   *z$SetPackageTests.test_decorator_attrsN) rrrr~rrrrrrrsrrrrrs rc@s4eZdZdZeddZddZddZdd Zd S) SetLoaderTestsz"Tests importlib.util.set_loader().csGfddd}|j_|S)NcseZdZjjddZdS)z/SetLoaderTests.DummyLoader..DummyLoadercSs|jSrrrrrrrhEsz;SetLoaderTests.DummyLoader..DummyLoader.load_moduleN)rrrr set_loaderrhrrirr DummyLoaderDsr) __class__r)r rrrirrAszSetLoaderTests.DummyLoadercCs~|}td|_z |j`Wnty0Yn0t0tdt | || djWdn1sp0YdSNblahrN) rr-r.rr;AttributeErrorrOrPrQrRr rhr r<rrrtest_no_attributeKs     z SetLoaderTests.test_no_attributecCsh|}td|_d|j_t0tdt| || djWdn1sZ0YdSr rr-r.rr;rOrPrQrRr rhrrrrtest_attribute_is_NoneVs    z%SetLoaderTests.test_attribute_is_NonecCsh|}td|_d|j_t0tdt| d| djWdn1sZ0YdS)NrrkrNrrrrrtest_not_reset^s    zSetLoaderTests.test_not_resetN) rrrr~propertyrrrrrrrrr=s   rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)ResolveNameTestsz$Tests importlib.util.resolve_name().cCs|d|jdddS)Nbaconr r resolve_namerirrr test_absolutepszResolveNameTests.test_absolutecCs|d|jdddS)Nrspamrrirrrtest_absolute_within_packagetsz-ResolveNameTests.test_absolute_within_packagecCs<|t|jddWdn1s.0YdS)N.baconrr#r$rrrirrrtest_no_packagexs z ResolveNameTests.test_no_packagecCs|d|jdddS)Nzspam.eggs.baconr spam.eggsrrirrrtest_in_package}s z ResolveNameTests.test_in_packagecCs|d|jdddS)Nz spam.bacon..baconrrrirrrtest_other_packages z#ResolveNameTests.test_other_packagecCs<|t|jddWdn1s.0YdS)Nrrrrirrr test_escapes zResolveNameTests.test_escapeN) rrrr~rrrrrrrrrrrlsrc@szeZdZGdddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS) FindSpecTestsc@seZdZedddZdS)zFindSpecTests.FakeMetaFinderNcCs |||fSrr)r/pathtargetrrr find_specsz&FindSpecTests.FakeMetaFinder.find_spec)NN)rrr staticmethodrrrrrFakeMetaFindersrcCs|d}t|Zt|}d}|j||}||_||_|tj |<|j |}| ||Wdn1sn0YdSNsome_modz a loader!) rrar-r.r!r"r;r8rcrdrr r r/rr<r'foundrrrtest_sys_moduless    zFindSpecTests.test_sys_modulescCszd}t|Xt|}|`d}|j||}||_|tj |<|j |}| ||Wdn1sl0YdSr) rrar-r.r;r!r"r8rcrdrr rrrr#test_sys_modules_without___loader__s    z1FindSpecTests.test_sys_modules_without___loader__c Csd}t|`t|}d|_|tj|<|t|j |Wdn1sV0YWdn1st0YdSNr) rrar-r.r8rcrdr# ValueErrorrrorrrtest_sys_modules_spec_is_Nones    z+FindSpecTests.test_sys_modules_spec_is_NonecCsrd}t|Pt|}|j|d}||_|tj|<|j |}| ||Wdn1sd0YdSr) rrar-r.r!r"r8rcrdrr )r r/rr'rrrrtest_sys_modules_loader_is_Nones    z-FindSpecTests.test_sys_modules_loader_is_Nonec Csd}t|vt|}z|`Wnty4Yn0|tj|<|t |j |Wdn1sl0YWdn1s0YdSr) rrar-r.r8rrcrdr#rrrorrr test_sys_modules_spec_is_not_sets     z.FindSpecTests.test_sys_modules_spec_is_not_setc Cs|d}t|Ztj|jgd*||ddf|j|Wdn1sP0YWdn1sn0YdS)Nr) meta_path)rraZ import_staterr rrgrrr test_successs    zFindSpecTests.test_successcCs||jddS)NZnevergoingtofindthismodule)Z assertIsNonerrrirrr test_nothingszFindSpecTests.test_nothingcCsd}d}tj|ddv}t|||\}}|j|}||d||ttj| |ttj|j|}| ||Wdn1s0YdSNrhamTr| r temp_module submoduler assertIsNotrbsortedrcrdrmr r r/subnamepkg_dirfullname_r' spec_againrrrtest_find_submodules   z!FindSpecTests.test_find_submodulecCsd}d}tj|dd}|j|t|||\}}|j|}||d||tt j | |tt j |j|}| ||Wdn1s0YdSr) rrinit import_modulerrrrbrrcrdrmr rrrr+test_find_submodule_parent_already_importeds    z9FindSpecTests.test_find_submodule_parent_already_importedc Csd}d}tj|dd}t|||\}}d|}|j||}||d||ttj| |ttj|j|}| ||Wdn1s0YdSNrrTr.r) r r/rrrrrelnamer'rrrrtest_find_relative_modules  z'FindSpecTests.test_find_relative_modulec Csd}d}tj|dd}t|||\}}d|}|t|j|Wdn1s^0Y||ttj ||ttj Wdn1s0YdSr) rrrr#r$rrmrrcrd)r r/rrrrrrrr)test_find_relative_module_missing_packages *z7FindSpecTests.test_find_relative_module_missing_packagecCs:|t|jdWdn1s,0YdS)Nz module.name)r#ModuleNotFoundErrorrrrirrrtest_find_submodule_in_modules z+FindSpecTests.test_find_submodule_in_moduleN)rrrrrrrrrrrrrrrrrrrrrs       r)rrr!c@seZdZddZddZdS)MagicNumberTestscCs|t|jjddS)N)r lenr MAGIC_NUMBERrirrr test_lengthszMagicNumberTests.test_lengthcCs||jjddS)Ns )rrrendswithrirrrtest_incorporates_rn!sz%MagicNumberTests.test_incorporates_rnN)rrrrrrrrrrsrc@seZdZdZejjZe ejjdudddZ ddZ dd Z d d Z d d ZddZddZddZddZddZeejdkoejdkdddZe ejjdudddZe ejjdudd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d.d/Z!d0d1Z"d2d3Z#e ejjdudd4d5Z$e ejjdudd6d7Z%e ejjdudd8d9Z&e ejjdudd:d;Z'e ejjdudd PEP3147TestszMTests of PEP 3147-related functions: cache_from_source and source_from_cache.Nz1requires sys.implementation.cache_tag not be Nonec CsJtjdddd}tjddddd|j}||jj|dd|dS Nfoobarbazqux.py __pycache__ qux.{}.pycr optimizationosrrformattagr rcache_from_sourcer rrrrrtest_cache_from_source1s z#PEP3147Tests.test_cache_from_sourcec CsjttjddF|t|jdWdn1s>0YWdn1s\0YdS)N cache_tagz whatever.py)r swap_attrrcimplementationr#NotImplementedErrorrrrirrr#test_cache_from_source_no_cache_tag<s z0PEP3147Tests.test_cache_from_source_no_cache_tagcCsBtjdd}tjddd|j}||jj|dd|dS)Nzfoo.barfilerz file{}.pycrrrrrrrtest_cache_from_source_no_dotBs  z*PEP3147Tests.test_cache_from_source_no_dotc Cs2tjdddd}t^td||j|d|jj|dd||j|d |jj|d dWdn1s~0Yttd | t |j|dWdn1s0Y| t |j|d Wdn1s0YWdn1s$0YdS) NrrrrrNFrrTrrV) rrrrOrPrQr rrr#rRr rrrr%test_cache_from_source_debug_overrideJs  "   , z2PEP3147Tests.test_cache_from_source_debug_overridecCs6d}tjdd|j}||jj|dd|dSNfoo.pyrz foo.{}.pycrrrrrrrtest_cache_from_source_cwd[s z'PEP3147Tests.test_cache_from_source_cwdc Cstjddd}Gddd}ttd||j|g|jj|dd||j|d g|jj|d d| t  |jd |Wdn1s0YWdn1s0YdS) Nrrzbaz.pyc@seZdZddZdS)z=PEP3147Tests.test_cache_from_source_override..BearishcSstdSr) RuntimeErrorrirrrrthrYzFPEP3147Tests.test_cache_from_source_override..Bearish.__bool__NrurrrrBearishgsrrNrrrz/foo/bar/baz.py) rrrrOrPrQr rrr#r)r rrrrrtest_cache_from_source_overrideas   z,PEP3147Tests.test_cache_from_source_overridecCs6d}tjdd|j}||jj|dd|dSrrrrrr0test_cache_from_source_optimization_empty_stringss z=PEP3147Tests.test_cache_from_source_optimization_empty_stringcCs|d}tjj}tjdd|j}|dkr4|d}n,|dkrL|d|}nd|}||| |j j |dd |dS) Nrrfoo.{}r.pyc .opt-{}.pycz){!r} is a non-standard optimization levelr) rcflagsoptimizerrrrrZskipTestr rr)r rZoptimization_level almost_expectrmsgrrr(test_cache_from_source_optimization_Nonezs   z5PEP3147Tests.test_cache_from_source_optimization_NonecCsd}tjtj}tjdd|j}|jj ||d}| ||d|| |jj |dd|d| t  |jj |ddWdn1s0YdS) Nrrrrrrkz .opt-42.pycz path/is/bad) string ascii_lettersdigitsrrrrrrrr r#r)r rZvalid_charactersrZgotrrr'test_cache_from_source_optimization_sets   z4PEP3147Tests.test_cache_from_source_optimization_setc CsrtVtd|t"|jjddddWdn1sF0YWdn1sd0YdS)NrNrFrr)rOrPrQr# TypeErrorrrrirrr;test_cache_from_source_debug_override_optimization_both_sets   zHPEP3147Tests.test_cache_from_source_debug_override_optimization_both_set\/z/test meaningful only where os.altsep is definedcCs$||jjdddd|jdS)Nz\foo\bar\baz/qux.pyrrz#\foo\bar\baz\__pycache__\qux.{}.pyc)r rrrrrirrr)test_sep_altsep_and_sep_cache_from_sources z6PEP3147Tests.test_sep_altsep_and_sep_cache_from_sourcec CsHtdddd}tjddddd|j}||jj |dd|dSr) pathlibPurePathrrrrrr rrrrrr$test_cache_from_source_path_like_args z1PEP3147Tests.test_cache_from_source_path_like_argz4requires sys.implementation.cache_tag to not be Nonec CsFtjddddd|j}tjdddd}||j||dSNrrrrrrrrrrrr rsource_from_cacherrrrtest_source_from_caches  z#PEP3147Tests.test_source_from_cachec Csztjddd}ttjddF|t|j |Wdn1sN0YWdn1sl0YdS)Nrrz whatever.pycr) rrrrrrcrr#rrrrrrr#test_source_from_cache_no_cache_tags z0PEP3147Tests.test_source_from_cache_no_cache_tagcCs|t|jjddS)Nz/foo/bar/bazqux.pycr#rrrrirrrtest_source_from_cache_bad_paths z,PEP3147Tests.test_source_from_cache_bad_pathcCs|t|jjddS)Nzfoo.cpython-32.pycrrirrrtest_source_from_cache_no_slashs z,PEP3147Tests.test_source_from_cache_no_slashcCs|t|jjddS)Nz__pycache__/foo.pycrrirrr#test_source_from_cache_too_few_dotss z0PEP3147Tests.test_source_from_cache_too_few_dotscCs:|t|jdWdn1s,0YdS)Nz(__pycache__/foo.cpython-32.opt-1.foo.pycrrirrr$test_source_from_cache_too_many_dotss z1PEP3147Tests.test_source_from_cache_too_many_dotscCs|t|jjddS)Nz"__pycache__/foo.cpython-32.foo.pycrrirrrtest_source_from_cache_not_optsz+PEP3147Tests.test_source_from_cache_not_optcCs|t|jjddS)Nz/foo/bar/foo.cpython-32.foo.pycrrirrr$test_source_from_cache_no__pycache__sz1PEP3147Tests.test_source_from_cache_no__pycache__cCs.tjdd|j}||j|ddS)Nrzfoo.{}.opt-1.pycrrrrrr)test_source_from_cache_optimized_bytecodesz6PEP3147Tests.test_source_from_cache_optimized_bytecodecCsPtjdd|j}|t|j|Wdn1sB0YdS)Nrzfoo.{}.opt-.pyc) rrrrrr#rrrrrrr+test_source_from_cache_missing_optimizations z8PEP3147Tests.test_source_from_cache_missing_optimizationc CsDtddddd|j}tjdddd}||j ||dSr) rrrrrrrr rrrrrr$test_source_from_cache_path_like_args   z1PEP3147Tests.test_source_from_cache_path_like_argc s(tjtjjddtjtjjddtjtjjddtjjg}dtjdkrrdfdd |D}|d d g7}|D]}|j|d tjtjjd ddd}tj|d ddd|j}t |(| |jj |dd|Wdn1s0YWdqv1s0YqvdS)Ntmpbytecodeu☃ztrailing-slashrntzC:csg|]}|qSrr).0prefixdriverr szOPEP3147Tests.test_cache_from_source_respects_pycache_prefix..z \\?\C:\fooz\\localhost\c$\bar)rrrrrrr) rrrsepr/ZsubTestrrrtemporary_pycache_prefixr r)r Zpycache_prefixespycache_prefixrrrr+r.test_cache_from_source_respects_pycache_prefixs2     z;PEP3147Tests.test_cache_from_source_respects_pycache_prefixc Cstjtjjdd}tjdddd}tjtdtjj}tj|tjt|dddd|jd }t |(| |jj |d d |Wdn1s0YdS) Nr&r'rrrrrqux.rrr) rrrr. splitdrivegetcwdrelpathrrr/r r)r r0rrootrrrr7test_cache_from_source_respects_pycache_prefix_relatives zDPEP3147Tests.test_cache_from_source_respects_pycache_prefix_relativec Cstjtjjdd}tj|dddd|jd}tjtjjdddd}t|$||j||Wdn1s~0YdS) Nr&r'rrrr2rr rrrr.rrr/r rr r0rrrrr,test_source_from_cache_inside_pycache_prefix's  z9PEP3147Tests.test_source_from_cache_inside_pycache_prefixc Cstjtjjdd}tjddddd|jd}tjdddd }t|$||j||Wdn1sx0YdS) Nr&r'rrrrr2rrr8r9rrr-test_source_from_cache_outside_pycache_prefix4s  z:PEP3147Tests.test_source_from_cache_outside_pycache_prefix))rrrr~rcrrrunittestZskipIfrrrrrrrr rr skipUnlessrr.altseprrrrrrrr r!r"r#r$r%r1r7r:r;rrrrr+sp        rc@s,eZdZdZeejjdvdddZ dS)rzA Test release compatibility issues relating to importlib ) candidatefinalz8only applies to candidate or final python release levelscCs2d}ttjjddd}d}||||dS)a Each python minor release should generally have a MAGIC_NUMBER that does not change once the release reaches candidate status. Once a release reaches candidate status, the value of the constant EXPECTED_MAGIC_NUMBER in this test should be changed. This test will then check that the actual MAGIC_NUMBER matches the expected value for the release. In exceptional cases, it may be required to change the MAGIC_NUMBER for a maintenance release. In this case the change should be discussed in python-dev. If a change is required, community stakeholders such as OS package maintainers must be notified in advance. Such exceptional releases will then require an adjustment to this test case. ia NrlittleaTo avoid breaking backwards compatibility with cached bytecode files that can't be automatically regenerated by the current user, candidate and final releases require the current importlib.util.MAGIC_NUMBER to match the expected magic number in this test. Set the expected magic number in this test to the current MAGIC_NUMBER to continue with the release. Changing the MAGIC_NUMBER for a maintenance release requires discussion in python-dev and notification of community stakeholders.)int from_bytesrrrr )r ZEXPECTED_MAGIC_NUMBERactualr rrrtest_magic_numberKs  z"MagicNumberTests.test_magic_numberN) rrrr~r<r=rc version_info releaselevelrErrrrrGs  __main__)2rrZimport_importlibr+rr!Zimportlib_utilimportlib.utilrrrr rcr rr-r<Z unittest.mockrOrZ test_bothZFrozen_DecodeSourceBytesTestsZSource_DecodeSourceBytesTestsrZFrozen_ModuleFromSpecTestsZSource_ModuleFromSpecTestsrMZFrozen_ModuleForLoaderTestsZSource_ModuleForLoaderTestsrZFrozen_SetPackageTestsZSource_SetPackageTestsrZFrozen_SetLoaderTestsZSource_SetLoaderTestsrZFrozen_ResolveNameTestsZSource_ResolveNameTestsrZFrozen_FindSpecTestsZSource_FindSpecTestsrZFrozen_MagicNumberTestsZSource_MagicNumberTestsrZFrozen_PEP3147TestsZSource_PEP3147TestsZTestCasermainrrrrsz       J  < , #    +