a „oe… ã @s8ddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZddlmZdejvZGd d „d e jƒZGd d „d ejƒZGd d„dƒZe d¡ZGdd„dejƒZdZdZdZ dZ!ej"dej#dej$dej%dej&dej'diZ(dd„Z)Gdd„dej*jj+ƒZ,e-d k�r4e .¡dS)!éN)Úaxscript)Úaxsite)Ú Exception)ÚDispatch)ÚconnectÚutil)Ú COMExceptionz-vc@seZdZdd„Zdd„ZdS)ÚMySitecGsd|_tjj|g|¢RŽdS©N)Úexception_seenrÚAXSiteÚ__init__)ÚselfÚargs©rúCC:\Program Files\Certbot\pkgs\win32comext\axscript\test\testHost.pyr szMySite.__init__cCs¦| ¡|_}| ¡\}}}ts$dStd|dƒz | ¡}WntjyVd}Yn0|durdd}|dd|ddd|d}| ¡D]}td|ƒq�dS) Nz >Exception:éÚÚ ú ú^éz >) ZGetExceptionInfor ZGetSourcePositionÚverboseÚprintZGetSourceLineTextÚ pythoncomÚ com_errorÚ splitlines)rÚerrorÚexcÚcontextÚlineÚcharÚstÚtextrrrÚ OnScriptErrors  $ zMySite.OnScriptErrorN)Ú__name__Ú __module__Ú __qualname__r r$rrrrr sr c@seZdZdd„ZdS)Ú MyCollectioncCs tj |¡Sr )rÚ CollectionÚ_NewEnum©rrrrr*(szMyCollection._NewEnumN)r%r&r'r*rrrrr('sr(c@s2eZdZddgZdgZdd„Zdd„Zdd „Zd S) ÚTestÚechoÚfailÚ collectioncCs*t|_t tgd¢ƒ¡|_d|_d|_dS)N)rZTwoérr)rrÚwrapr(r/ÚlastÚ fail_calledr+rrrr 0sz Test.__init__cGs<d dd„|Dƒ¡|_|jr8|D]}t|dd�q tƒdS)NrcSsg|] }t|ƒ‘qSr)Ústr)Ú.0ÚsrrrÚ 9ózTest.echo..r©Úend)Újoinr2rr©rrÚargrrrr-8s z Test.echocGs.tdƒ|D]}t|dd�q tƒd|_dS)Nz**** fail() called ***rr9r)rr3r<rrrr.?s z Test.failN)r%r&r'Z_public_methods_Z_public_attrs_r r-r.rrrrr,,s r,z&{8EB72F90-0D44-11d1-9C4B-00AA00125A98}c@s*eZdZegZdd„Zdd„Zdd„ZdS)ÚTestConnectServercCs ||_dSr )Úobject)rr?rrrr UszTestConnectServer.__init__cCs| |j|f¡dSr )Z_BroadcastNotifyÚ NotifyDoneIt)rr=rrrÚ BroadcastXszTestConnectServer.BroadcastcCs| ddtjd|¡dS)Nièrr)ZInvokerZDISPATCH_METHOD)rZ interfacer=rrrr@\szTestConnectServer.NotifyDoneItN)r%r&r'ÚIID_ITestEventsZ_connect_interfaces_r rAr@rrrrr>Psr>aprop = "Property Value" sub hello(arg1) test.echo arg1 end sub sub testcollection if test.collection.Item(0) <> 1 then test.fail("Index 0 was wrong") end if if test.collection.Item(1) <> "Two" then test.fail("Index 1 was wrong") end if if test.collection.Item(2) <> 3 then test.fail("Index 2 was wrong") end if num = 0 for each item in test.collection num = num + 1 next if num <> 3 then test.fail("Collection didn't have 3 items") end if end sub u!# A unicode ©omment. prop = "Property Value" def hello(arg1): test.echo(arg1) def testcollection(): # test.collection[1] = "New one" got = [] for item in test.collection: got.append(item) if got != [1, "Two", 3]: test.fail("Didn't get the collection") pass uAdef hello(arg1): raise RuntimeError("exc with extended ©har") zbad code for everyone! ÚSCRIPTSTATE_UNINITIALIZEDÚSCRIPTSTATE_INITIALIZEDÚSCRIPTSTATE_STARTEDÚSCRIPTSTATE_CONNECTEDÚSCRIPTSTATE_DISCONNECTEDÚSCRIPTSTATE_CLOSEDcCsJ|jj ¡}||krFt |t|ƒ¡}t |t|ƒ¡}td|||fƒ‚dS)Nz1Warning - engine %s has state %s, but expected %s)ÚengineZeScriptZGetScriptStateÚ state_mapÚgetr4Ú RuntimeError)rIÚnameÚstateZgotZgot_nameZ state_namerrrÚ_CheckEngineState s ÿÿrOc@s>eZdZddd„Zdd„Zdd„Zdd „Zd d „Zd d „ZdS)Ú EngineTesterNc Cs>tƒ}dt |¡i}t|ƒ}| |¡}�zþt||tjƒ| |¡|  ¡t||tj ƒ|  |j d¡t | ¡ƒ}z$| d¡|  |dud|f¡Wnjtj�y|durÄ| d|jf¡||jdvrê| d||jdf¡YW| ¡d}d}dS0| |jd¡| t|jƒd¡| ¡|  |j d¡|j d dddd d tj¡} | | d¡| tj¡t||tjƒ|  ¡t||tj ƒ| tj¡t||tjƒ| tj¡t||tjƒ| tj¡t||tjƒ| tj¡t||tjƒ| tj¡t||tjƒW| ¡d}d}n| ¡d}d}0dS) NÚtestz Fail should not have been calledZGooberz"Expected %r, but no exception seenz'Unexpected failure from script code: %srzCould not find %r in %rzProperty Valuez1+1r) r,rr1r Z _AddEnginerOrrDZAddCodeZStartrEZ assertTruer3rZGetScriptDispatchZhellorrr.r ÚCloseZ assertEqualr2r4ZpropZtestcollectionZeParseZParseScriptTextZSCRIPTTEXT_ISEXPRESSIONZSetScriptStaterFrG) rZ engineNameÚcodeZ expected_excZechoerZmodelZsiterIÚobÚresultrrrÚ _TestEngine¬s€ ÿ    þÿÿ ÿÿßÿ       þzEngineTester._TestEnginecCs| dt¡dS©NÚVBScript)rVrXr+rrrÚtestVBïszEngineTester.testVBcCs| dt¡dS©NÚPython©rVÚPyScriptr+rrrÚ testPythonòszEngineTester.testPythoncCs| dt¡dSrZr\r+rrrÚtestPythonUnicodeErrorõsz#EngineTester.testPythonUnicodeErrorcCs| tj|jdt¡dSrW)Z assertRaisesrrrVÚ ErrScriptr+rrrÚtestVBExceptionsøszEngineTester.testVBExceptionscCsd}| dt|¡dS)Nu%RuntimeError: exc with extended ©harr[)rVÚ PyScript_Exc)rZexpectedrrrÚtestPythonExceptionsûsz!EngineTester.testPythonExceptions)N) r%r&r'rVrYr^r_rarcrrrrrP«s  CrPÚ__main__)/ÚsysZunittestrZwin32com.server.policyZwin32comZwin32com.test.utilZwin32com.axscriptrZwin32com.axscript.serverrZwin32com.axscript.server.errorrZwin32com.client.dynamicrZwin32com.serverrrZwin32com.server.exceptionrÚargvrr r r)r(r,ZMakeIIDrBZConnectableServerr>rXr]rbr`rCrDrErFrGrHrJrOrQZTestCaserPr%ÚmainrrrrÚs>      ! ú  U