§ x<ˆj£ãóz—dZddlZddlZddlZ ddlZdZn#e$rdZdZYnwxYwd„Zd„Zd„Z d„Z d „Z d „Z d „Z dS) aL Example module that is tested in :py:class`pyfakefs.example_test.TestExample`. This demonstrates the usage of the :py:class`pyfakefs.fake_filesystem_unittest.TestCase` base class. The modules related to file handling are bound to the respective fake modules: >>> os #doctest: +ELLIPSIS >>> os.path #doctest: +ELLIPSIS >>> shutil #doctest: +ELLIPSIS `open()` is an alias for `io.open()` and is bound to `FakeIoModule.open`. éNTFcó¸—t|dd¬¦«5}| d|›d�¦«| d¦«ddd¦«dS#1swxYwYdS)a£Create the specified file and add some content to it. Use the `open()` built in function. For example, the following file operations occur in the fake file system. In the real file system, we would not even have permission to write `/test`: >>> os.path.isdir('/test') False >>> os.mkdir('/test') >>> os.path.isdir('/test') True >>> os.path.exists('/test/file.txt') False >>> create_file('/test/file.txt') >>> os.path.exists('/test/file.txt') True >>> with open('/test/file.txt', encoding='utf8') as f: ... f.readlines() ["This is test file '/test/file.txt'.\n", 'It was created using open().\n'] ÚwÚutf8)ÚencodingzThis is test file 'z'. zIt was created using open(). N)ÚopenÚwrite©ÚpathÚfs úh/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/pyfakefs/tests/example.pyÚ create_filer .s«€õ. ˆd�C &Ð )Ñ )Ô )ð2¨QØ �ŠÐ0 dÐ0Ð0Ð0Ñ1Ô1Ð1Ø �ŠÐ0Ñ1Ô1Ð1ð2ð2ð2ñ2ô2ð2ð2ð2ð2ð2ð2ð2øøøð2ð2ð2ð2ð2ð2s“/AÁAÁAcó.—tj|¦«dS)a0Delete the specified file. For example: >>> os.mkdir('/test') >>> os.path.exists('/test/file.txt') False >>> create_file('/test/file.txt') >>> os.path.exists('/test/file.txt') True >>> delete_file('/test/file.txt') >>> os.path.exists('/test/file.txt') False N)ÚosÚremove©r s r Ú delete_filerJs€õ„Iˆd�O„O€O€O€Oócó@—tj |¦«S)a5Return True if the specified file exists. For example: >>> path_exists('/test') False >>> os.mkdir('/test') >>> path_exists('/test') True >>> >>> path_exists('/test/file.txt') False >>> create_file('/test/file.txt') >>> path_exists('/test/file.txt') True )rr Úexistsrs r Ú path_existsr\s€õ" Œ7�>Š>˜$Ñ Ô Ðrcó*—tj|¦«S)aReturn the list of paths matching the specified glob expression. For example: >>> os.mkdir('/test') >>> create_file('/test/file1.txt') >>> create_file('/test/file2.txt') >>> file_names = sorted(get_glob('/test/file*.txt')) >>> >>> import sys >>> if sys.platform.startswith('win'): ... # Windows style path ... file_names == [r'/test\file1.txt', r'/test\file2.txt'] ... else: ... # UNIX style path ... file_names == ['/test/file1.txt', '/test/file2.txt'] True )Úglob)Ú glob_paths r Úget_globrps€õ& Œ9�YÑ Ô Ðrcó.—tj|¦«dS)z$Delete the specified file hierarchy.N)ÚshutilÚrmtreers r Úrm_treer†s€å „M�$ÑÔÐÐÐrcó”—tr!ttj|¦«¦«Sttj|¦«¦«S)z6Return a list of directory entries for the given path.)Ú has_scandirÚlistÚscandirrrs r Úscan_dirr#‹s:€åð+Ý•G”O DÑ)Ô)Ñ*Ô*Ð*Ý •” ˜4Ñ Ô Ñ !Ô !Ð!rcó~—t|d¦«5}| ¦«cddd¦«S#1swxYwYdS)z4Return the contents of the given path as byte array.ÚrbN)rÚreadr s r Ú file_contentsr'’s~€å ˆd�DÑ Ô ð˜QØ�vŠv‰xŒxððððñôððððððøøøððððððs ‘2²6¹6)Ú__doc__rrrr"r Ú ImportErrorr rrrrr#r'©rr úr+sÝðð ðð" € € € Ø € € € Ø € € € ðØ€N€N€Nà€K€KøØðððØ€GØ€K€K€Kðøøøð 2ð2ð2ð8ððð$ ð ð ð( ð ð ð,ððð "ð"ð"ðððððs �— #¢#