a  ze@sddlZddlmZddlmZddlmZGdddejejZGdd d ejejZ Gd d d Z Gd d d e ejZ Gddde ej ejZ edkredS)N) resources)data01)utilc@seZdZddZdS)CommonBinaryTestscCs0t||Wdn1s"0YdSN)r open_binaryselfpackagepathr Q/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/test_open.pyexecute szCommonBinaryTests.executeN__name__ __module__ __qualname__rr r r rrsrc@seZdZddZdS)CommonTextTestscCs0t||Wdn1s"0YdSr)r open_textr r r rrszCommonTextTests.executeNrr r r rrsrc@s<eZdZddZddZddZddZd d Zd d Zd S) OpenTestscCsFt|jd$}|}||dWdn1s80YdS)Nz binary.files)rrdataread assertEqualr fpresultr r rtest_open_binaryszOpenTests.test_open_binarycCsFt|jd$}|}||dWdn1s80YdS)Nz utf-8.filezHello, UTF-8 world! rrrrrrr r rtest_open_text_default_encodingsz)OpenTests.test_open_text_default_encodingcCsJt|jddd}|}Wdn1s00Y||ddS)N utf-16.filezutf-16strictzHello, UTF-16 world! rrr r rtest_open_text_given_encodings  &z'OpenTests.test_open_text_given_encodingcCst|jddd}|t|jWdn1s60Yt|jddd}|}Wdn1sp0Y||ddS)Nr zutf-8r!ignorez*Hello, UTF-16 world! )rrr assertRaises UnicodeErrorrrrr r rtest_open_text_with_errors%s , &z$OpenTests.test_open_text_with_errorscCs|ttj|jddSNzdoes-not-exist)r$FileNotFoundErrorrrrr r r r"test_open_binary_FileNotFoundError3s z,OpenTests.test_open_binary_FileNotFoundErrorcCs|ttj|jddSr')r$r(rrrr)r r r test_open_text_FileNotFoundError8s z*OpenTests.test_open_text_FileNotFoundErrorN) rrrrrr"r&r*r+r r r rrs rc@seZdZddZdS) OpenDiskTestscCs t|_dSr)rrr)r r rsetUp?szOpenDiskTests.setUpN)rrrr-r r r rr,>sr,c@s eZdZdS) OpenZipTestsN)rrrr r r rr.Csr.__main__)Zunittest importlibrrrZCommonResourceTestsZTestCaserrrr,ZZipSetupr.rmainr r r rs   *