"ydZddlZddlZddlZddlZddlmZGddejZe dkrej dSdS)zTests that ensure that the `tempfile` module works with `fake_filesystem` if using `Patcher` (via `fake_filesystem_unittest`). N)fake_filesystem_unittestcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) FakeTempfileModuleTestz5Test the 'tempfile' module with the fake file system.c.|dSN) setUpPyfakefs)selfs s/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/tests/fake_tempfile_test.pysetUpzFakeTempfileModuleTest.setUps c\tj}||j|j||t5|j|jddddS#1swxYwYdSr) tempfileNamedTemporaryFile assertTruefs get_objectnameclose assertRaisesOSError)r objs r test_named_temporary_filez0FakeTempfileModuleTest.test_named_temporary_file!s)++ **3844555   w ' ' ) ) G  sx ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )s4 B!!B%(B%ctjd}|d||j|j}|j}|d|tjddd}|d||j|j}|d|jdS)NF)deletesfoofoowutf8)modeencodingr) rrwriterrrrcontents assertEqual)r rfile_objr!s r #test_named_temporary_file_no_deletez:FakeTempfileModuleTest.test_named_temporary_file_no_delete(s)777 & 7%%ch//$ ))))sVERRR % 7%%ch//  122222r c:t|jj}tj}|dt|||dtj tj d|||d||j |d|jj rdnd}||j|djt j|ztj|dd}||d|dS)Ntmprzw+b)lenr open_filesrmkstempr"r startswithospathjoin gettempdirexists is_windows_fsrst_modestatS_IFREGfdopenfileno)r next_fd temporaryrfhs r test_mkstempz#FakeTempfileModuleTest.test_mkstemp5sGdg())$&&  C NN+++  aL # #BGLL1D1F1F$N$N O O    )A,/// y|44555-8uu5 ++IaL99A4RSSSSSr cbtj5}||||j|||j|jtj dzddddS#1swxYwYdSrE) rTemporaryDirectoryrrr3r"rr5r6rG)r tmpdirs r test_temporary_directoryz/FakeTempfileModuleTest.test_temporary_directory[s  ( * * Wf OOF # # # OODGNN622 3 3 3   TW//77?PUAU V V V W W W W W W W W W W W W W W W W W WsBB$$B(+B(ctj5}|d|d|d|ddddS#1swxYwYdS)Ntestr)r TemporaryFiler seekr"readr fs r test_temporary_filez*FakeTempfileModuleTest.test_temporary_fileas  # % % 0 GGG    FF1III   Waffhh / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sAA44A8;A8c|t5tjddddn #1swxYwYt jdtj5}|d|d|d| ddddS#1swxYwYdS)Nz/parentr?rOr) rFileNotFoundErrorrrPr/mkdirr rQr"rRrSs r test_temporay_file_with_dirz2FakeTempfileModuleTest.test_temporay_file_with_dirgs?   0 1 1 2 2  "y 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2   # % % 0 GGG    FF1III   Waffhh / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s"=AA/ACCCN) __name__ __module__ __qualname____doc__r rr$r=rCrIrMrUrYr r rrs??))) 3 3 3 4 4 4XXX$TTT WWW 000 00000r r__main__) r]r/r6runittestpyfakefsrTestCaserrZmainr^r r rds ------S0S0S0S0S05>S0S0S0l zHMOOOOOr