a  ze @sddlZddlZddlZddlmZddlmZddlmZm Z m Z m Z m Z m Z mZmZGdddejejejejZGdd d ejejZdS) N)Iterator)fixtures) DistributionPackageNotFoundError distribution entry_pointsfilesmetadatarequiresversionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ e ddZ ddZ ddZddZddZddZddZddZd d!Zd"S)#APITestsz\d+\.\d+(\.\d)?cCs td}dSN egginfo-pkgr selfZ pkg_versionrY/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/test_metadata_api.pytest_retrieves_version_of_selfsz'APITests.test_retrieves_version_of_selfcCs td}dSN distinfo-pkgrrrrr&test_retrieves_version_of_distinfo_pkgsz/APITests.test_retrieves_version_of_distinfo_pkgcCs6|ttdWdn1s(0YdS)Nzdoes-not-exist)Z assertRaisesrrrrrrtest_for_name_does_not_exist s z%APITests.test_for_name_does_not_existcCs|tddddS)Nr top_level.txtmod) assertEqualr read_textstriprrrrtest_for_top_level$szAPITests.test_for_top_levelcCs*ddtdDd}||ddS)NcSsg|]}|jdkr|qS)rname).0pathrrr *s z+APITests.test_read_text..rrzmod )r rr)rZ top_levelrrrtest_read_text)s zAPITests.test_read_textcCs6ttd}|d}||jd||jgdS)Nentriesmainzmod:main)dictrrvalueextras)rr'Zeprrrtest_entry_points0szAPITests.test_entry_pointscCstd}|d}dS)NrZ Classifier)r Zget_all)rZmdZ classifiersrrrtest_metadata_for_this_package6s z'APITests.test_metadata_for_this_packagecCs,|dj}|D]}|jdr|qdS)Nrz.py)rootr"endswithr)r r.filerrr _test_files>s  zAPITests._test_filescCs0|j}ddtdDd}|t|jddS)NcSsg|]}|jdkr|qS)zmod.pyr!)r#prrrr%Ns z0APITests.test_file_hash_repr..rrz!) assertRegexr reprhash)rr3utilrrrtest_file_hash_reprKszAPITests.test_file_hash_reprcCs|tddSrr1r rrrrtest_files_dist_infoVszAPITests.test_files_dist_infocCs|tddSrr8rrrrtest_files_egg_infoYszAPITests.test_files_egg_infocCs|tdddS)N egginfo-filez0.1)rr rrrrtest_version_egg_info_file\sz#APITests.test_version_egg_info_filecCstd}||dS)Nr;)r Z assertIsNone)rZ requirementsrrrtest_requires_egg_info_file_sz$APITests.test_requires_egg_info_filecCs td}dSrr rdepsrrrtest_requires_egg_infocszAPITests.test_requires_egg_infocCs td}dSrr>r?rrrtest_requires_dist_infoksz APITests.test_requires_dist_infocCs$td}tt|}gd}dS)Nz dep1 dep2 [:python_version < "3"] dep3 [extra1] dep4 [extra2:python_version < "3"] dep5 )Zdep1Zdep2zdep3; python_version < "3"zdep4; extra == "extra1"z2dep5; (python_version < "3") and extra == "extra2")textwrapdedentsortedrZ_deps_from_requires_text)rr r@Zexpectedrrr$test_more_complex_deps_requires_textrs  z-APITests.test_more_complex_deps_requires_textN)__name__ __module__ __qualname__Zversion_patternrrrr r&r,r- staticmethodr1r7r9r:r<r=rArBrFrrrrr s$  r c@s$eZdZddZddZddZdS)OffSysPathTestscCstjt|jgd}dS)N)r$)rZdiscoverstrsite_dir)rZdistsrrr&test_find_distributions_specified_pathsz6OffSysPathTests.test_find_distributions_specified_pathcCs|jd}t|}dS)zBDemonstrate how to load metadata direct from a directory. distinfo_pkg-1.0.0.dist-infoN)rMratrZdist_info_pathdistrrrtest_distribution_at_pathlibs  z,OffSysPathTests.test_distribution_at_pathlibcCs|jd}tt|}dS)NrO)rMrrPrLrQrrrtest_distribution_at_strs z(OffSysPathTests.test_distribution_at_strN)rGrHrIrNrSrTrrrrrKsrK)rerCZunittestcollections.abcrrimportlib.metadatarrrrr r r r Z EggInfoPkgZ DistInfoPkgZ EggInfoFileZTestCaser ZDistInfoPkgOffPathrKrrrrs  (