a 5êdg÷ã @sÀddlZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ejjsŒze  e ¡Wn eefyŠe d¡‚Yn0dd„ZGdd„dejƒZdd „Zed kr¼eƒdS) éN)Ú run_unittestÚrmtreeÚ change_cwdÚTESTFN_ENCODINGÚTESTFN_UNICODEÚTESTFN_UNENCODABLEÚcreate_empty_filez1No Unicode filesystem semantics on this platform.cCstj |¡rt |¡dS©N)ÚosÚpathÚexistsÚunlink)Úfilename©rú2/usr/local/lib/python3.9/test/test_unicode_file.pyÚremove_if_existss rc@s<eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S)ÚTestUnicodeFilesc Cs>| tj |¡¡| tj |¡¡| t |tj¡¡| tj tj |¡¡¡| tj tj |¡¡¡| t tj |¡tj¡¡t |d¡t  |d¡t  |t   ¡t   ¡f¡|  ||¡| tj |¡tj t   t   |¡¡d¡k¡tj tj |¡¡\}}t |¡}t d|¡}dd„|Dƒ}| ||¡dS)NiÿrÚNFDcSsg|]}t d|¡‘qS)r)Ú unicodedataÚ normalize)Ú.0ÚfrrrÚ 2óz/TestUnicodeFiles._do_single..)Ú assertTruer r r ÚisfileÚaccessÚR_OKÚabspathÚchmodÚutimeÚtimeÚ _do_copyishÚglobÚescapeÚsplitÚlistdirrrZassertIn)Úselfrr ÚbaseZ file_listrrrÚ _do_singles$   &ÿ  zTestUnicodeFiles._do_singlecCs^| tj |¡¡t ||d¡| tj |¡¡| tj |d¡¡t |d|¡| tj |d¡¡| tj |¡¡t ||d¡t |d¡t  ||d¡| tj  |¡¡| tj  |d¡¡t  |d|¡| tj  |d¡¡| tj  |¡¡t  ||d¡| tj |d¡¡t |d¡| tj  |d¡¡dS)Nz.new) rr r rÚrenameZ assertFalseÚshutilÚcopyr Úmover Úcopy2)r'Z filename1Ú filename2rrrr"7s&zTestUnicodeFiles._do_copyishc Csžtj |¡rt|ƒt |¡znt|ƒHt ¡}|}t d|¡}t d|¡}|  tj  |¡|¡Wdƒn1sv0YWt  |¡n t  |¡0dS)Nr) r r ÚisdirrÚmkdirrÚgetcwdrrZ assertEqualÚbasenameÚrmdir)r'Z make_nameZ chdir_nameZ cwd_resultZ name_resultrrrÚ _do_directoryTs     4zTestUnicodeFiles._do_directoryc CsŒt|ƒt|ƒz| |¡Wt |¡n t |¡0| tj |¡ ¡t |tj ¡}t  |¡z| |¡Wt |¡n t |¡0dSr ) rrr)r r rr r ÚopenÚO_CREATÚclose)r'rrrrrÚ _test_singlefs   zTestUnicodeFiles._test_singlecCs | t¡tdur| t¡dSr )r9rr)r'rrrÚtest_single_filesxs z"TestUnicodeFiles.test_single_filescCs8d}| t|t|¡tdur4| t|t|¡dS)Nz.dir)r5rr)r'ÚextrrrÚtest_directories}s  ÿz!TestUnicodeFiles.test_directoriesN) Ú__name__Ú __module__Ú __qualname__r)r"r5r9r:r<rrrrrs rcCs ttƒdSr )rr=rrrrÚ test_mainˆsr@Ú__main__)r r#r!r+rZunittestZ test.supportrrrrrrrr Úsupports_unicode_filenamesÚencodeÚ UnicodeErrorÚ TypeErrorZSkipTestrZTestCaserr@r=rrrrÚs $q