a „oeÑ ã@s‚dZddlZddlZddlZddlZddlZddlZddlZGdd„dejƒZ Gdd„de ƒZ Gdd„de ƒZ e d kr~e  ¡dS) zTest pywin32's error semanticséNc@seZdZdd„ZdS)ÚTestBasecCs0tjdkr| |||¡| |j||¡dS©N©é)ÚsysÚ version_infoÚ assertEqualÚargs)ÚselfÚexcÚindexÚexpected©rú;C:\Program Files\Certbot\pkgs\win32\test\test_exceptions.pyÚ_testExceptionIndex s zTestBase._testExceptionIndexN)Ú__name__Ú __module__Ú __qualname__rrrrrr src@s„eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„ZdS) Ú TestAPISimplec CsHzt d¡Wn*tjy8}z|WYd}~Sd}~00| d¡dS)Néz$Didn't get invalid-handle exception.)Úwin32apiÚ CloseHandleÚerrorÚfail©r r rrrÚ_getInvalidHandleExceptions z(TestAPISimple._getInvalidHandleExceptioncCs| tjtjd¡dS©Nr)Ú assertRaisesÚ pywintypesrrr©r rrrÚ testSimpleszTestAPISimple.testSimplecCs| ¡}| |dtj¡dS©Nr)rrÚwinerrorÚERROR_INVALID_HANDLErrrrÚtestErrnoIndex szTestAPISimple.testErrnoIndexcCs| ¡}| |dd¡dS)Nrr)rrrrrrÚ testFuncIndex$szTestAPISimple.testFuncIndexcCs*| ¡}t tj¡ ¡}| |d|¡dS)Né)rrÚ FormatMessager"r#Úrstripr©r r r rrrÚtestMessageIndex(szTestAPISimple.testMessageIndexc Cs€zt d¡| d¡Wnbtjyz}zH| |jtj¡| |jd¡t tj¡  ¡}| |j |¡WYd}~n d}~00dS)Nrzexpected exception!r) rrrrrr"r#Úfuncnamer'r(Ústrerror)r r Z expected_msgrrrÚ testUnpack-s ÿzTestAPISimple.testUnpackcCs<| ¡}t tj¡ ¡}tjd|f}| t|ƒt|ƒ¡dS©Nr)rrr'r"r#r(rÚstr©r r Úerr_msgZ err_tuplerrrÚ testAsStr9s zTestAPISimple.testAsStrcCsR| ¡}t tj¡ ¡}tjd|f}tjdkr@| t |ƒ|¡n| |j |¡dS)Nrr) rrr'r"r#r(rrrÚtupler r0rrrÚ testAsTuple@s   zTestAPISimple.testAsTuplecCs| ¡}| |jjd¡dS)Nr)rrÚ __class__rrrrrÚ testClassNameJszTestAPISimple.testClassNamecCs| ¡}| |jtju¡dS©N)rÚ assertTruer5rrrrrrÚ testIdentityOszTestAPISimple.testIdentitycCs| tjjtf¡dSr7)rrrÚ __bases__Ú ExceptionrrrrÚ testBaseClassSszTestAPISimple.testBaseClasscCsH| ¡}t tj¡ ¡}| |jtj¡| |j|¡| |jd¡dSr.) rrr'r"r#r(rr,r+©r r r1rrrÚtestAttributesVs zTestAPISimple.testAttributesc Cszzt ¡‚| d¡Wn^tjyt}zD| |jd¡| |jd¡| |jd¡| |jd¡WYd}~n d}~00dS©NúExpected exceptionr©rrrrr r"r+r,rrrrÚtestStrangeArgsNone^sz!TestAPISimple.testStrangeArgsNonec Cs€zt d¡‚| d¡Wnbtjyz}zH|jddksrBrErJrrrrrs    rc@s|eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)Ú TestCOMSimplec CsLzt ddd¡Wn*tjy<}z|WYd}~Sd}~00| d¡dS)NrDrzDidn't get storage exception.)Ú pythoncomÚStgOpenStorageÚ com_errorrrrrrÚ _getException€s zTestCOMSimple._getExceptioncCs| tjtju¡dSr7)r8rLrNrrrrrÚtestIs‡szTestCOMSimple.testIscCs| tjtjddd¡dS)NrDr)rrLrNrMrrrrr ŠszTestCOMSimple.testSimplecCs| ¡}| |dtj¡dSr!)rOrr"ÚSTG_E_INVALIDFLAGrrrrr$szTestCOMSimple.testErrnoIndexcCs*| ¡}t tj¡ ¡}| |d|¡dSr)rOrr'r"rQr(rr)rrrr*‘szTestCOMSimple.testMessageIndexcCs>| ¡}t tj¡ ¡}tj|ddf}| t|ƒt|ƒ¡dSr7)rOrr'r"rQr(rr/r0rrrr2–szTestCOMSimple.testAsStrcCsT| ¡}t tj¡ ¡}tj|ddf}tjdkrB| t |ƒ|¡n| |j |¡dSr) rOrr'r"rQr(rrrr3r r0rrrr4s  zTestCOMSimple.testAsTuplecCs| ¡}| |jjd¡dS)NrN)rOrr5rrrrrr6§szTestCOMSimple.testClassNamecCs| ¡}| |jtju¡dSr7)rOr8r5rrNrrrrr9«szTestCOMSimple.testIdentitycCs| ¡}| tjjtf¡dSr7)rOrrrNr:r;rrrrr<¯szTestCOMSimple.testBaseClasscCsV| ¡}t tj¡ ¡}| |jtj¡| |j|¡| |j d¡| |j d¡dSr7) rOrr'r"rQr(rÚhresultr,ÚargerrorÚ excepinfor=rrrr>³s zTestCOMSimple.testAttributesc Csˆzt ¡‚| d¡Wnltjy‚}zR| |jd¡| |jd¡| |jd¡| |jd¡| |jd¡WYd}~n d}~00dSr?) rrNrrr rRr,rSrTrrrrrB»sz!TestCOMSimple.testStrangeArgsNonec CsŽzt d¡‚| d¡Wnptjyˆ}zV| |jdd¡| |jd¡| |jd¡| |jd¡| |jd¡WYd}~n d}~00dSrC© rrNrrr rRr,rTrSrrrrrEÆs z&TestCOMSimple.testStrangeArgsNotEnoughc Csªz"t dddddd¡‚| d¡Wn‚tjy¤}zh| |jdd¡| |jdd¡| |jd¡| |jd¡| |jd¡| |jd¡WYd}~n d}~00dSrFrUrrrrrJÑsz$TestCOMSimple.testStrangeArgsTooManyN)rrrrOrPr r$r*r2r4r6r9r<r>rBrErJrrrrrKs   rKÚ__main__)Ú__doc__rZunittestrLrrZ win32filer"ZTestCaserrrKrÚmainrrrrÚs j_