a  ze@sddlZddlmZmZddlmZddlmZGdddejejZ Gdd d ejejZ Gd d d Z Gd d d e ejZ Gddde ej ejZedkredS)N) import_module resources)data01)utilc@seZdZddZdS)CommonBinaryTestscCst||dSN)r read_binaryselfpackagepathrQ/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_importlib/test_read.pyexecute szCommonBinaryTests.executeN__name__ __module__ __qualname__rrrrrrsrc@seZdZddZdS)CommonTextTestscCst||dSr)r read_textr rrrrszCommonTextTests.executeNrrrrrr src@s,eZdZddZddZddZddZd S) ReadTestscCst|jd}||ddS)N binary.file)rr data assertEqualr resultrrrtest_read_binaryszReadTests.test_read_binarycCst|jd}||ddS)Nz utf-8.filezHello, UTF-8 world! rrrrrrrrtest_read_text_default_encodingsz)ReadTests.test_read_text_default_encodingcCs"tj|jddd}||ddS)N utf-16.filezutf-16)encodingzHello, UTF-16 world! rrrrrtest_read_text_given_encodingsz'ReadTests.test_read_text_given_encodingcCs6|ttj|jdtj|jddd}||ddS)Nr!ignore)errorsz*Hello, UTF-16 world! )Z assertRaises UnicodeErrorrrrrrrrrtest_read_text_with_errors s z$ReadTests.test_read_text_with_errorsN)rrrrr r#r'rrrrrsrc@seZdZeZdS) ReadDiskTestsN)rrrrrrrrrr(,sr(c@seZdZddZddZdS) ReadZipTestscCs$td}t|d}||ddSNzziptestdata.subdirectoryrr)rrr r)r Z submodulerrrrtest_read_submodule_resource1s z)ReadZipTests.test_read_submodule_resourcecCstdd}||ddSr*)rr rrrrr$test_read_submodule_resource_by_name7sz1ReadZipTests.test_read_submodule_resource_by_nameN)rrrr+r,rrrrr)0sr)__main__)Zunittest importlibrrrrZCommonResourceTestsZTestCaserrrr(ZZipSetupr)rmainrrrrs