Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyc


oUNc@sdZddlZddlZddlmZddlmZddlmZm	Z	dej
fdYZde	jfd	YZ
d
e
fdYZdZd
e	jfdYZdZdS(s'
Test cases for twisted.python.zshcomp
iN(tStringIO(tunittest(tzshcomptusagetZshcompTestCasecBsDeZdZdZdZdZdZdZdZRS(sT
    Tests for the zsh completion function builder in twisted/python/zshcomp.py
    cCs|j}tj|gtj|D]}|d^q)}x]tjD]R}|d|kreqIntjj|d|d}|jtjj	|qIWdS(sn
        Build all the completion functions for twisted commands - no errors
        should be raised
        it_N(
tmktemptostmkdirRtmakeCompFunctionFilestgenerateFortpathtjoint
assertTruetexists(tselftdirnametxtskippedCmdstinfotfuncPath((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyt
test_buildAlls
&cCst}tjd|d}tjj}|jtjtjj}|jtj|j|j	||j|j
||j|jtj|j|j
tj|j|jtj|j|jtjdS(sg
        The zsh_* variables you can place on Options classes are
        picked up correctly?
        t	dummy_cmdtdummy_valueN(tFighterAceExtendedOptionsRtArgumentsGeneratortFighterAceOptionstzsh_altArgDescrtcopytupdatetzsh_actionDescrtassertEqualtaltArgDescrtactionDescrtmultiUsetzsh_multiUsetmutuallyExclusivetzsh_mutuallyExclusivetactionstzsh_actionstextrast
zsh_extras(RtoptstagR R!((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyttest_accumulateMetadata%s	
cCsnt}tjd|d}|jd|j|jd|j|jd|j|jd|jdS(s
        We pick up options that are only defined by having an
        appropriately named method on your Options class,
        e.g. def opt_foo(self, foo)
        RRtnocrasht
difficultyN(RRRtassertInt
optFlags_dtoptAll_dtoptParams_d(RR*R+((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyt test_accumulateAdditionalOptions<s	cCs?dtfdY}|}|jttjd|ddS(s\
        Using a parameter/flag name that doesn't exist
        will raise an error
        t
TmpOptionscBseZidd6ZRS(tfootdetaill(t__name__t
__module__R'(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyR4QsRRN(RtassertRaisest
ValueErrorRR(RR4R*((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyttest_verifyZshNamesLs	cCs[d}t}t}tj|||}|j|j|j|jtdS(st
        Generate a completion function, and test the textual output
        against a known correct output
        ttestprogN(	tSillyOptionsRRtBuildertwritetresetRtreadttestOutput1(Rtcmd_nameR*tftb((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyttest_zshCodeYs		

cCsd	g}tjd|i}|jt|d|jt|dd|j|ddd|jt|ddtdS(
sq
        makeCompFunctionFiles skips building for commands whos
        script module cannot be imported
        ttest_cmdsno.way.your.gonna.import.thistFootout_diriiiN(RGsno.way.your.gonna.import.thisRH(RR	RtlenR
t
isinstancetImportError(RR
tskips((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyttest_skipBuildgs	(	R7R8t__doc__RR,R3R;RFRN(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyRs				
	Rc	BseZdZdddgdddgddd	gd
ddgd
ddgdddgdddggZdd"ddgddddggZidd
6dd6Zidd6ZdgZdddd
ggZ	id d6Z
d!gZRS(#sB
    Command-line options for an imaginary "Fighter Ace" game
    tfokkerRDs2Select the Fokker Dr.I as your dogfighter aircrafttalbatrostas5Select the Albatros D-III as your dogfighter aircrafttspadtss1Select the SPAD S.VII as your dogfighter aircrafttbristolREs4Select the Bristol Scout as your dogfighter aircrafttphysicstps$Enable secret Twisted physics enginetjamtjs6Enable a small chance that your machine guns will jam!tverbosetvs1Verbose logging (may be specified more than once)s
pilot-namesWhat's your name, Ace?sManfred von Richthofentdetailtds*Select the level of rendering detail (1-5)t3sTwisted-PhysicssRendering detail levelsPick your details(1 2 3 4 5)s:saved game file to load:_filesN(R7R8ROtoptFlagstNonet
optParametersRRR#R%R'R)(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyRvs4	


	
RcBsaeZdZdd
dggZdd
ddggZidd6Zidd6ZdZd	Z	RS(s
    Extend the options and zsh metadata provided by FighterAceOptions. zshcomp
    must accumulate options and metadata from all classes in the hiearchy so
    this is important for testing
    s	no-stallss+Turn off the ability to stall your aircrafts
reality-levels)Select the level of physics reality (1-5)t5sCan't stall your planesPhysics reality levelcCsdS(s&Select that you can't crash your planeN((R((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pytopt_nocrashscCsdS(sHow tough are you? (1-10)N((RR.((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pytopt_difficultysN(
R7R8ROR`R_RaRRRcRd(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyRs

	cCsdS(Ns(1 2 3)((((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyt_accuracyActionsR=cBseZdZdddgdddgddd	ggZd
dddgd
dddggZidd6dd
6Zidd
6dd
6ZdgZddggZ	idd
6e
d
6ZdgZRS(s4
    Command-line options for a "silly" program
    tcolortcsTurn on color outputtgraytgsTurn on gray-scale outputRZR[s1Verbose logging (may be specified more than once)toptimizations&Select the level of optimization (1-5)RbtaccuracyRRs"Select the level of accuracy (1-3)R^sColor onsOptimization levels
Optimization?s	Accuracy?s(1 2 3 4 5)s:output file:_filesN(
R7R8ROR_R`RaRRR#R%ReR'R)(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyR=s$	



	

si#compdef testprog
_arguments -s -A "-*" \
':output file:_files' \
'(--accuracy)-a[3]:Accuracy?:(1 2 3)' \
'(-a)--accuracy=[3]:Accuracy?:(1 2 3)' \
'(--gray -g --color)-c[Color on]' \
'(--gray -g -c)--color[Color on]' \
'(--color -c --gray)-g[Turn on gray-scale output]' \
'(--color -c -g)--gray[Turn on gray-scale output]' \
'--help[Display this help and exit.]' \
'--optimization=[Optimization level]:Optimization?:(1 2 3 4 5)' \
'*-v[Verbose logging (may be specified more than once)]' \
'*--verbose[Verbose logging (may be specified more than once)]' \
'--version[Display Twisted version and exit.]' \
&& return 0
(RORtos.patht	cStringIORt
twisted.trialRttwisted.pythonRRtTestCaseRtOptionsRRReR=RB(((sD/usr/lib/python2.7/dist-packages/twisted/python/test/test_zshcomp.pyt<module>sf$	,