{G_Tc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z de fdYZ ddl m Z dejfdYZdefd YZd efd YZd efd YZdefdYZdZde jfdYZdefdYZefZedeiZdefdYZdefdYZdefdYZdefdYZdefdYZ d efd!YZ!d"efd#YZ"d$efd%YZ#d&efd'YZ$d(efd)YZ%d*efd+YZ&d,efd-YZ'd.efd/YZ(d0efd1YZ)d2efd3YZ*d4efd5YZ+d6efd7YZ,d8efd9YZ-d:efd;YZ.d<efd=YZ/d>efd?YZ0d@efdAYZ1dBefdCYZ2dDefdEYZ3dFefdGYZ4dHefdIYZ5dJefdKYZ6dLefdMYZ7dNefdOYZ8dPefdQYZ9dRefdSYZ:dTefdUYZ;dVefdWYZ<dXefdYYZ=dZefd[YZ>d\efd]YZ?d^efd_YZ@d`efdaYZAdbefdcYZBddefdeYZCdfefdgYZDdhefdiYZEdjefdkYZFdlefdmYZGdnefdoYZHdpefdqYZIdrefdsYZJdtefduYZKdvefdwYZLdxefdyYZMdzefd{YZNd|efd}YZOd~efdYZPdefdYZQdefdYZRdefdYZSdefdYZTdefdYZUdefdYZVdefdYZWdefdYZXdefdYZYdefdYZZdefdYZ[defdYZ\defdYZ]defdYZ^defdYZ_defdYZ`defdYZadefdYZbdefdYZcdefdYZddefdYZedefdYZfdefdYZgdeefdYZhdeefdYZidefdYZjdefdYZkdeefdYZldeefdYZmdeefdYZndefdYZoejpeqedoejrdkddeefdYZsdeefdYZtdefdYZudefdYZvdefdYZwdefdYZxdefdYZydefdYZzdefdYZ{defdYZ|defdYZ}defdYZ~defdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdefdYZdee~fdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdeefdYZdefdYZdefdYZdefdYZdefdYZefZedeiZdefdYZdefd YZd efd YZd efd YZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZd efd!YZd"efd#YZd$efd%YZd&efd'YZd(efd)YZd*efd+YZd,efd-YZd.efd/YZd0efd1YZd2efd3YZd4efd5YZd6efd7YZd8efd9YZd:efd;YZd<efd=YZd>efd?YZd@efdAYZdBefdCYZdDefdEYZdFefdGYZdHefdIYZdJefdKYZdLefdMYZdNefdOYZdPefdQYZdRefdSYZdTefdUYZdVefdWYZdXefdYYZdZefd[YZd\efd]YZd^efd_YZd`efdaYZdbefdcYZddefdeYZdfefdgYZdhefdiYZdjZedkkrendS(liN(tStringIOt StdIOBuffercBseZRS((t__name__t __module__(((s./usr/local/lib/python2.7/test/test_argparse.pyRs(t test_supporttTestCasecBseZdZdZRS(cCsQ||kr4dGHt|GHt|GH|GH|GHntt|j||dS(Nt(treprtsuperRt assertEqual(tselftobj1tobj2((s./usr/local/lib/python2.7/test/test_argparse.pyR s   cCs-tj}|jd|j|jdS(NtCOLUMNS(RtEnvironmentVarGuardtunsett addCleanupt__exit__(R tenv((s./usr/local/lib/python2.7/test/test_argparse.pytsetUp s  (RRR R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t TempDirMixincBs#eZdZdZdZRS(cCs2tj|_tj|_tj|jdS(N(ttempfiletmkdtempttemp_dirtostgetcwdtold_dirtchdir(R ((s./usr/local/lib/python2.7/test/test_argparse.pyR+scCstj|jx_tj|jdtD]E\}}}x3|D]+}tjtjj|j|t j q?Wq)Wt j |jt dS(Nttopdown(RRRtwalkRtFalsetchmodtpathtjointstattS_IWRITEtshutiltrmtreetTrue(R troottdirstfilestname((s./usr/local/lib/python2.7/test/test_argparse.pyttearDown0s ( -cCsTtjj|j|}t|d}|j|WdQXtj|tjdS(Ntw( RR R!RtopentwriteRR"tS_IREAD(R tfilenamet file_pathtfile((s./usr/local/lib/python2.7/test/test_argparse.pytcreate_readonly_file7s(RRRR+R3(((s./usr/local/lib/python2.7/test/test_argparse.pyR)s  tSigcBseZdZRS(cOs||_||_dS(N(targstkwargs(R R5R6((s./usr/local/lib/python2.7/test/test_argparse.pyt__init__?s (RRR7(((s./usr/local/lib/python2.7/test/test_argparse.pyR4=stNScBs2eZdZdZdZdZdZRS(cKs|jj|dS(N(t__dict__tupdate(R R6((s./usr/local/lib/python2.7/test/test_argparse.pyR7FscCsRt|jj}djg|D]}d|^q"}dt|j|fS(Ns, s%s=%rs%s(%s)(tsortedR9titemsR!ttypeR(R t sorted_itemsttupt kwarg_str((s./usr/local/lib/python2.7/test/test_argparse.pyt__repr__Is&cCst|t|kS(N(tvars(R tother((s./usr/local/lib/python2.7/test/test_argparse.pyt__eq__PscCs ||k S(N((R RC((s./usr/local/lib/python2.7/test/test_argparse.pyt__ne__SsN(RRR7RAtNonet__hash__RDRE(((s./usr/local/lib/python2.7/test/test_argparse.pyR8Ds    tArgumentParserErrorcBseZddddZRS(cCs>tj||||||_||_||_||_dS(N(t ExceptionR7tmessagetstdouttstderrt error_code(R RJRKRLRM((s./usr/local/lib/python2.7/test/test_argparse.pyR7Ys    N(RRRFR7(((s./usr/local/lib/python2.7/test/test_argparse.pyRHWsc Os]ttjts$ttjtr1|||Stj}tj}tt_tt_zy|||}xptt|D]\}t||tjkrt|||nt||tjkrt|||qqW|SWnWt k rAtj dj }tjj }tjj } t d|| |nXWd|t_|t_XdS(Nit SystemExit(t isinstancetsysRLRRKtlistRBtgetattrtsetattrRNtexc_infotcodetgetvalueRH( t parse_argsR5R6t old_stdoutt old_stderrtresulttkeyRURKRL((s./usr/local/lib/python2.7/test/test_argparse.pytstderr_to_parser_erroras,$       tErrorRaisingArgumentParsercBs#eZdZdZdZRS(cOs"tt|j}t|||S(N(RR]RWR\(R R5R6RW((s./usr/local/lib/python2.7/test/test_argparse.pyRWscOs"tt|j}t|||S(N(RR]texitR\(R R5R6R^((s./usr/local/lib/python2.7/test/test_argparse.pyR^scOs"tt|j}t|||S(N(RR]terrorR\(R R5R6R_((s./usr/local/lib/python2.7/test/test_argparse.pyR_s(RRRWR^R_(((s./usr/local/lib/python2.7/test/test_argparse.pyR]s  tParserTesterMetaclasscBseZdZdZRS(s}Adds parser tests using the class attributes. Classes of this type should specify the following attributes: argument_signatures -- a list of Sig objects which specify the signatures of Argument objects to be created failures -- a list of args lists that should cause the parser to fail successes -- a list of (initial_args, options, remaining_args) tuples where initial_args specifies the string args to be parsed, options is a dict that should match the vars() of the options parsed out of initial_args, and remaining_args should be any remaining unparsed arguments c Cs|dkrdSt|ds.t|_nt|dsIt|_nd}d}d}d}d}d tfd Y} x>|||gD]-} x$||gD]} | || | qWqWdS( NtParserTestCasetparser_signaturet parser_classcSs+x$|D]}|j|j|jqWdS(s(Add all arguments directly to the parserN(t add_argumentR5R6(tparsertargument_signaturestsig((s./usr/local/lib/python2.7/test/test_argparse.pyt no_groupss cSs:|jd}x$|D]}|j|j|jqWdS(s4Add all arguments under a single group in the parsertfooN(tadd_argument_groupRdR5R6(ReRftgroupRg((s./usr/local/lib/python2.7/test/test_argparse.pyt one_groups cSsJxCt|D]5\}}|jd|}|j|j|jq WdS(s0Add each argument in its own group to the parsersfoo:%iN(t enumerateRjRdR5R6(ReRftiRgRk((s./usr/local/lib/python2.7/test/test_argparse.pyt many_groupsscSs |j|S(s#Parse the args by passing in a list(RW(ReR5((s./usr/local/lib/python2.7/test/test_argparse.pytlistargsscSs<tj}|dg|t_z|jSWd|t_XdS(s(Parse the args by defaulting to sys.argviN(RPtargvRW(ReR5t old_sys_argv((s./usr/local/lib/python2.7/test/test_argparse.pytsysargss  tAddTestscBs,eZdZdZdZdZRS(c Ss||_||_|jj}|jj}x~|j|jgD]j}|j}|||f}dj|} |d} y | | _Wntk rnXt|| | q=WdS(Nt_cSs||dS(N((R t test_func((s./usr/local/lib/python2.7/test/test_argparse.pytwrappers(t_add_argumentst _parse_argsRt test_failuresttest_successesR!t TypeErrorRS( R t tester_clst add_argumentsRWtadd_arguments_nametparse_args_nameRvt func_nametnamest test_nameRw((s./usr/local/lib/python2.7/test/test_argparse.pyR7s        cSsA|jj}|jj}|j||}|j||j|S(N(RbR5R6RcRxRf(R ttesterR5R6Re((s./usr/local/lib/python2.7/test/test_argparse.pyt _get_parsers   cSsO|j|}x9|jD].}|j}|j}|t|j|qWdS(N(Rtfailurestsplitt assertRaisesRHRW(R RRetargs_strR5traises((s./usr/local/lib/python2.7/test/test_argparse.pyRzs   cSsm|j|}xW|jD]L\}}t|trC|j}n|j||}|j||qWdS(N(Rt successesROtstrRRyR (R RReR5t expected_nst result_ns((s./usr/local/lib/python2.7/test/test_argparse.pyR{s (RRR7RRzR{(((s./usr/local/lib/python2.7/test/test_argparse.pyRts   (thasattrR4RbR]Rctobject( tclsR*tbasestbodydictRhRlRoRpRsRtR~RW((s./usr/local/lib/python2.7/test/test_argparse.pyR7s      -(RRt__doc__R7(((s./usr/local/lib/python2.7/test/test_argparse.pyR`sRatTestOptionalsSingleDashcBseZdZedgZdddddgZdedd fdeddfd eddfd edd fd edd fgZRS(s1Test an Optional with a single-dash option strings-xtas--foos-x --foos-x -yRtxs-x as-xas-x -1s-1s-x-1N( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestOptionalsSingleDashCombinedcBseZdZedddedddddedgZd d d d d ddddddg Zdededd!dd!fdede dd!dd!fdededd!dd fdededd!dd fdede dd!dd fdede dd!dd fdede dd!dd fdede dd!dd fdededddd!fdededddd!fdede dddd fd ede dddd fg Z RS("s1Test an Optional with a single-dash option strings-xtactiont store_trues-yyyt store_consttconsti*s-zRs--foos-xas-x --foos-x -zs-z -xs-yxs-yz as-yyyxs-yyyzas-xyzaRRtyyytzs-zas-z as-xzas-xz as-x -zas-x -z as-ys -x -yyy -zas -x -yyy -z aN( RRRR4RfRR8RRFR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs$tTestOptionalsSingleDashLongcBseZdZedgZddddddgZdeddfd eddfd edd fd eddfd eddfgZRS(sATest an Optional with a multi-character single-dash option strings-fooRs--foos -foo --foos-foo -ys-fooaRRis-foo as-foo -1s-1s-fo as-f aN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR0st&TestOptionalsSingleDashSubsetAmbiguouscBs"eZdZedededgZddddddd gZd ed dd dd dfded dd dd dfded dd dd dfded dd dd dfded dd dd dfded dd dd dfded dd dd dfgZRS(s=Test Optionals where option strings are subsets of each others-fs-foobars-foorabs-foos-fos-foo bs-foobs-foobas-fooraRtftfoobartfoorabs-f aRs-fas-foatoas-fooatooas -foobar as -foorab aN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR>s!t TestOptionalsSingleDashAmbiguousc BseZdZededgZddddddd gZd ed dd dfd ed dd dfded dd dfded dd dfded dd dfded dd dfded dd dfgZRS(s7Test Optionals that partially match but are not subsetss-foobars-foorabs-fs-f as-fas-foas-foos-fos-foo bRRRs-foob aRs-foor as-fooba as-foora as -foobar as -foorab aN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRNstTestOptionalsNumericcBseZdZedddgZddddddgZd eddfd eddfd eddfd edd fgZRS(s(Test an Optional with a short opt strings-1tdesttoneRs-1 --foos-1 -ys-1 -1s-1 -2Rs-1 as-1as-1-2s-2N( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR^stTestOptionalsDoubleDashcBseZdZedgZddddddgZdeddfd eddfd eddfd edd fd edd fgZRS(s1Test an Optional with a double-dash option strings--foos-fs-f aRs--foo -xs --foo --barRRis--foo as--foo=as --foo -2.5s-2.5s --foo=-2.5N( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRkst#TestOptionalsDoubleDashPartialMatchc BseZdZedddedgZddddd d gZd ed ed dfded ed dfded e d dfded e d dfded e d dfded e d dfgZ RS(s7Tests partial matching with a double-dash option strings--badgerRRs--bats--bars--bs--bas--b=2s--ba=4s --badge 5Rtbadgertbats--bat XtXs--bads--badgs--badgeN( RRRR4RfRR8RRFR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRyst"TestOptionalsDoubleDashPrefixMatchc BseZdZedddedgZdddddgZd ed ed dfd ed ed d fded ed d fded e d dfded e d dfded e d dfded e d dfgZ RS(s?Tests when one double-dash option string is a prefix of anothers--badgerRRs--bas--bars--bs--b=2s --badge 5RRtbas--ba XRs--ba=Xs--bads--badgs--badgeN( RRRR4RfRR8RRFR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestOptionalsSingleDoubleDashc BseZdZedddededddddgZdd d d d d gZdededdddfdede ddddfdededd ddfdede dd ddfdede ddddfdede ddddfgZ RS(s<Test an Optional with single- and double-dash option stringss-fRRs--bars-bazRRi*s-fbars-fbazs-bazfs-b BtBRRtbartbazs--ba Bs -f --bar Bs-f -bs-ba -fN( RRRR4RfRR8RRFR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t!TestOptionalsAlternatePrefixCharsc Bs:eZdZedddeZedddededdd d d gZd d ddddddddddg Zdededd dd fdede dd dd fdededddd fdede dddd fdede dd dd fdede dd dd fgZ RS(!s9Test an Optional with option strings with custom prefixest prefix_charss+:/tadd_helps+fRRs::bars/bazRRi*s--bars-fbars-b BRs-fs--bar Bs-bazs-hs--helps+hs::helps/helpRRRRs::ba Bs +f ::bar Bs+f /bs/ba +fN( RRRR4RRbRfRR8RFR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs *t*TestOptionalsAlternatePrefixCharsAddedHelpc Bs+eZdZedddeZedddededdd d d gZd d dddddgZdede ddddfdededdddfdede ddddfdededdddfdededddd fdededddd fgZ RS(sWhen ``-`` not in prefix_chars, default operators created for help should use the prefix_chars in use rather than - or -- http://bugs.python.org/issue9444Rs+:/Rs+fRRs::bars/bazRRi*s--bars-fbars-b BRs-fs--bar Bs-bazRRRRs::ba Bs +f ::bar Bs+f /bs/ba +fN( RRRR4R&RbRfRR8RRFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t2TestOptionalsAlternatePrefixCharsMultipleShortArgsc BseZdZedddeZedddedddedddgZd d d d d gZdedededefdede dedefdede de defdede de de fgZ RS(s@Verify that Optionals must be called with their defined prefixesRs+-Rs-xRRs+ys+zs-ws-xyzs+xs-ys+xyzRRtyRs+y -xs+yz -x( RRRR4RRbRfRR8R&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestOptionalsShortLongcBseZdZeddddddgZddd d gZd ed efded efded efded efded efgZ RS( s<Test a combination of single- and double-dash option stringss-vs --verboses-ns--noisyRRs --x --verboses-NRs-v xRtverbose( RRRR4RfRR8RR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestOptionalsDestc BseZdZededddgZdgZdeddddfd edddd fd edd dd fdeddddfgZRS(s*Tests various means of setting destinations --foo-bars--bazRtzabbazRs --foo-bar ftfoo_barRs--baz gtgs--foo-bar h --baz ithRns--baz j --foo-bar ktktjN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestOptionalsDefaultcBseZdZededddgZdgZdedd ddfd eddddfd edd ddfgZRS( s*Tests specifying a default for an Optionals-xs-ytdefaulti*RRRRs-xxs-yyN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsNargsDefaultcBsSeZdZedgZddgZdeddfdeddfgZRS(s7Tests not specifying the number of args for an Optionals-xRRRs-x aN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsNargs1cBs\eZdZedddgZddgZdeddfdeddgfgZRS( s*Tests specifying the 1 arg for an Optionals-xtnargsiRRRs-x aN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR&s  tTestOptionalsNargs3cBsneZdZedddgZddddddgZd ed dfd ed dd d gfgZRS(s+Tests specifying the 3 args for an Optionals-xRiRs-x as-x a bsa -xsa -x bRRs-x a b ctbtcN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR1s tTestOptionalsNargsOptionalcBseZdZedddedddddeddddd ed ddd edd dd gZdgZdedddddd ddfdedddddd ddfdedddddd ddfdedddddd ddfdedddddd ddfdeddddddddfdeddddddddfd edddddd ddfdedddddd ddfg Z RS(s0Tests specifying an Optional arg for an Optionals-wRt?s-xRi*s-yRtspams-zR=t42t84t2RR,RRRiTs-w 2s-x 2s-y 2s-z 2iN( RRRR4tintRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR<s' $$$$$$$$tTestOptionalsNargsZeroOrMorec BseZdZedddedddddgZdgZded dd dfded gd dfd ed dgd dfd ed dd gd dfded dd gfded dd dgfded dd dd gfgZRS(sBTests specifying an args for an Optional that accepts zero or mores-xRt*s-yRRRRRRs-x as-x a bRs-y as-y a bN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRSs tTestOptionalsNargsOneOrMorec BseZdZedddedddddgZddddd gZd ed dd dfd ed dgd dfded ddgd dfded dd dgfded dd ddgfgZRS(sATests specifying an args for an Optional that accepts one or mores-xRt+s-yRRRsa -xsa -y bRRRs-x as-x a bRs-y as-y a bN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRfstTestOptionalsChoicesc BseZdZedddeddededgZddd d d gZd ed dddfded dddfded dddfded dddfded dddfded dddfgZ RS(s,Tests specifying the choices for an Optionals-ftchoicestabcs-gR=iRs-f ds-fads-gas-g 6RRRs-f as-f cRs-g 0is-g 03is-fb -g4RiN( RRRR4RtrangeRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRws!tTestOptionalsRequiredcBs_eZdZeddedegZddgZdeddfd edd fgZ RS( s-Tests the an optional action that is requireds-xR=trequiredRRs-x 1Ris-x42i*( RRRR4RR&RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsActionStorecBsYeZdZedddgZddgZdedd fdedd fgZRS( s&Tests the store action for an Optionals-xRtstoreRsa -xRRs-xfooRiN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsActionStoreConstcBs\eZdZeddddegZdgZdeddfdedefgZ RS( s,Tests the store_const action for an Optionals-yRRRRRRN( RRRR4RRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsActionStoreFalsecBs\eZdZedddgZdddgZdedefdedefgZ RS( s,Tests the store_false action for an Optionals-zRt store_falseRs-zas-z aRR( RRRR4RfRR8R&RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestOptionalsActionStoreTruecBs\eZdZedddgZdddgZdedefdedefgZ RS( s+Tests the store_true action for an Optionals--appleRRRs --apple=bs --apple bRtapple( RRRR4RfRR8RR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestOptionalsActionAppendcBszeZdZedddgZddddgZdedd fd eddgfd eddd gfgZRS( s'Tests the append action for an Optionals--bazRtappendRsa --bazs --baz a bRRs--baz as--baz a --baz bRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t$TestOptionalsActionAppendWithDefaultcBseZdZedddddggZddddgZd ed dgfd ed ddgfd ed ddd gfgZRS(s'Tests the append action for an Optionals--bazRRRRRsa --bazs --baz a bRRs--baz as--baz a --baz bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestOptionalsActionAppendConstc BseZdZeddddeedddddgZd dd d d gZd eddfdedegfdedededgfgZ RS(s-Tests the append_const action for an Optionals-bRt append_constRs-cRRRRsa -cs-bxs-b xRs-b -cx -b -cyzRtyzN( RRRR4RIRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRst)TestOptionalsActionAppendConstWithDefaultc BseZdZeddddeddgedddd d gZd dd d dgZded dgfded degfded dededgfgZRS(s-Tests the append_const action for an Optionals-bRRRRRs-cRRRRsa -cs-bxs-b xRs-b -cx -b -cyzRR( RRRR4RIRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestOptionalsActionCountcBs_eZdZedddgZddddgZded d fded d fgZRS( s&Tests the count action for an Optionals-xRtcountRs-x as-x bs -x a -x bRRiN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestPositionalsNargsNonecBsDeZdZedgZdddgZdeddfgZRS(s,Test a Positional that doesn't specify nargsRiRs-xsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestPositionalsNargs1cBsMeZdZedddgZdddgZdeddgfgZRS(s.Test a Positional that specifies an nargs of 1RiRiRs-xsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestPositionalsNargs2cBsSeZdZedddgZddddgZdeddd gfgZRS( s.Test a Positional that specifies an nargs of 2RiRiRRs-xsa b csa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestPositionalsNargsZeroOrMorecBsqeZdZedddgZdgZdedgfdeddgfdedddgfgZRS( s0Test a Positional that specifies unlimited nargsRiRRs-xRRsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR$s  t%TestPositionalsNargsZeroOrMoreDefaultcBsweZdZedddddgZdgZdeddfdeddgfd eddd gfgZRS( s>Test a Positional that specifies unlimited nargs and a defaultRiRRRRs-xRRsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR0s  tTestPositionalsNargsOneOrMorecBsbeZdZedddgZddgZdeddgfdedddgfgZRS( s2Test a Positional that specifies one or more nargsRiRRRs-xRsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR<s  tTestPositionalsNargsOptionalcBsYeZdZedddgZddgZdeddfdeddfgZRS( sTests an Optional PositionalRiRRs-xsa bRRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRGs  t#TestPositionalsNargsOptionalDefaultcBs_eZdZedddddgZddgZdeddfd edd fgZRS( s1Tests an Optional Positional with a default valueRiRRRi*s-xsa bRR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRRs  t,TestPositionalsNargsOptionalConvertedDefaultcBsheZdZeddddeddgZddd gZd edd fd edd fgZRS(snTests an Optional Positional with a default value that needs to be converted to the appropriate type. RiRRR=RRs-xsa bs1 2Ri*t1i( RRRR4RRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR]s !tTestPositionalsNargsNoneNonecBsVeZdZededgZddddgZdeddddfgZRS( s-Test two Positionals that don't specify nargsRiRRs-xRsa b csa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRlstTestPositionalsNargsNone1cBs_eZdZededddgZddddgZd edddd gfgZRS( s6Test a Positional with no nargs followed by one with 1RiRRiRs--fooRsa b csa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRvstTestPositionalsNargs2NonecBseeZdZedddedgZddddd gZd eddd gdd fgZRS( s8Test a Positional with 2 nargs followed by one with noneRiRiRRs--fooRsa bsa b c dsa b cRR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRst"TestPositionalsNargsNoneZeroOrMorec BseZdZededddgZddgZdedddgfdedddd gfd edddd d gfgZRS( s>Test a Positional with no nargs followed by one with unlimitedRiRRRRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  t!TestPositionalsNargsNoneOneOrMorecBszeZdZededddgZdddgZdedddd gfd edddd d gfgZRS( s@Test a Positional with no nargs followed by one with one or moreRiRRRRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t TestPositionalsNargsNoneOptionalcBsqeZdZededddgZdddgZdedddd fd edddd fgZRS( s@Test a Positional with no nargs followed by one with an OptionalRiRRRRs--foosa b cRsa bRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t"TestPositionalsNargsZeroOrMoreNonecBseZdZedddedgZddgZdedgddfdeddgdd fd eddd gdd fgZRS( s@Test a Positional with unlimited nargs followed by one with noneRiRRRRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  t!TestPositionalsNargsOneOrMoreNonecBszeZdZedddedgZdddgZdeddgdd fd eddd gdd fgZRS( sBTest a Positional with one or more nargs followed by one with noneRiRRRRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t TestPositionalsNargsOptionalNonecBsweZdZedddddedgZddd gZd edddd fd edd dd fgZRS( sBTest a Positional with an Optional nargs followed by one with noneRiRRRi*RRs--foosa b cRsa bR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $tTestPositionalsNargs2ZeroOrMorecBseZdZedddedddgZdddgZd eddd gdgfd eddd gdd gfgZRS( s=Test a Positional with 2 nargs followed by one with unlimitedRiRiRRRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $tTestPositionalsNargs2OneOrMorecBskeZdZedddedddgZdddd gZd eddd gdd gfgZRS( s?Test a Positional with 2 nargs followed by one with one or moreRiRiRRRs--fooRsa bsa b cRR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs$tTestPositionalsNargs2OptionalcBseZdZedddedddgZdddd gZd eddd gddfd eddd gdd fgZRS(s7Test a Positional with 2 nargs followed by one optionalRiRiRRRs--fooRsa b c dsa bRsa b cRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $tTestPositionalsNargsZeroOrMore1cBseZdZedddedddgZddgZdedgddgfd eddgdd gfd eddd gdd gfgZRS( s=Test a Positional with unlimited nargs followed by one with 1RiRRRiRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $ tTestPositionalsNargsOneOrMore1cBseZdZedddedddgZdddgZd eddgdd gfd eddd gdd gfgZRS( s?Test a Positional with one or more nargs followed by one with 1RiRRRiRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $tTestPositionalsNargsOptional1cBs}eZdZedddedddgZdddgZd edd dd gfd edd dd gfgZRS( s?Test a Positional with an Optional nargs followed by one with 1RiRRRiRs--foosa b cRsa bRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $t#TestPositionalsNargsNoneZeroOrMore1c BseZdZededddedddgZddd gZd edd dgdd gfd edd dd gdd gfgZRS(s=Test three Positionals: no nargs, unlimited nargs and 1 nargsRiRRRRiRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs !t"TestPositionalsNargsNoneOneOrMore1c BseZdZededddedddgZddd d gZd edd dd gdd gfd edd dd d gddgfgZRS(s?Test three Positionals: no nargs, one or more nargs and 1 nargsRiRRRRiRs--fooRRsa b cRsa b c dtd(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs $t!TestPositionalsNargsNoneOptional1c BseZdZededddddedddgZd d d gZd edd dddd gfdedd dd ddgfgZRS(s;Test three Positionals: no nargs, optional narg and 1 nargsRiRRRRg?RiRs--fooRsa bRsa b cR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR .s !t$TestPositionalsNargsOptionalOptionalcBseZdZedddedddddgZddgZd edd ddfd edd ddfd edd dd fgZRS(sTest two optional nargsRiRRRRi*s--foosa b cRRsa bRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR =s t&TestPositionalsNargsOptionalZeroOrMorec BseZdZedddedddgZdgZdedd dgfdedddgfd edddd gfd edddd d gfgZRS(s1Test an Optional narg followed by unlimited nargsRiRRRRs--fooRRsa bRsa b cRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR Ls$ t%TestPositionalsNargsOptionalOneOrMorec BseZdZedddedddgZddgZdedd ddgfd edddd gfd edddd d gfgZRS(s3Test an Optional narg followed by one or more nargsRiRRRRRs--fooRsa bRsa b cRN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR Ys $ tTestPositionalsChoicesStringcBsheZdZeddedgZdddddgZd edd fd edd fgZRS( s&Test a set of single-character choicesRRtabcdefgRs--fooRRtefRR( RRRR4tsetRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR es tTestPositionalsChoicesIntcBsneZdZeddededgZddddd gZd edd fd edd fgZ RS(sTest a set of integer choicesRR=RiRs--fooRRRt4it15i( RRRR4RRRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRps !tTestPositionalsActionAppendcBsqeZdZedddedddddgZdddd d gZd eddd d ggfgZRS(sTest the 'append' actionRRRRiRs--fooRsa bsa b c dsa b cRR(RRRR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR{s t"TestOptionalsNumericAndPositionalsc BseZdZedddedddddgZd d gZd edddefd edd defdeddde fd edd de fgZ RS(s;Tests negative number args when numeric options are presentRRRs-4RRRRs-2s-315RRs-4 aN( RRRR4RfRR8RFRR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t(TestOptionalsAlmostNumericAndPositionalsc BseZdZedddedddddgZd gZd edddefd edd defd edd defdeddde fd edd de fgZ RS(sBTests negative number args when almost numeric options are presentRRRs-k4RRRRs-k3Rs-2Rs-k4 aN( RRRR4RfRR8RFRR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t$TestEmptyAndSpaceContainingArgumentsc BseZedddeddddgZdgZdgedddd fdgedddd fd gedd dd fddgedd ddfddgedd ddfdd gedd dd fd gedd ddfd gedd dd fgZRS( RRRs-ys--yyyRRRsa badgers -a badgers--yyy=a badgers--yyy=-a badgerN(RRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs t TestPrefixCharacterOnlyArgumentsc Bs.eZeddZeddddddded dd d ed d edddddgZddgZdeddd d de fdeddd d de fdeddd d de fdeddd dde fdeddd d de fdeddd d de fgZ RS(Rs-+t-RRRRRRRRR=Ri*s-+-RRRs-ys+ -Rs- XRs+ -3is- ===s===N( RRR4RbRRfRR8RFRR&R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestNargsZeroOrMorec BseZdZedddedddgZgZdedd dgfdedgdgfdeddgdgfd eddgdd gfdedd ddgfd edgddgfd edd gddgfgZRS(sBTests specifying an args for an Optional that accepts zero or mores-xRRRRRs-x aRs -x a -- bRsa -xsa -x bN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs$tTestNargsRemainderc BseZdZededddedgZdddgZdedddgd dfd edddgd d fd edddd ddd gd dfdedddddgd dfgZRS(s2Tests specifying a positional with nargs=REMAINDERRRRs...s-zRs-z ZRRs-z Z XtZs X A B -z ZtARs X Y --footYs--fooN( RRRR4RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs'*tTestOptionLikecBseZdZeddeeddeddedddgZdd d d d d dddddddg Zdedd%dd%dgfdedddd%dgfdedddd%ddgfdedd%dddgfdedd%dddgfdedd%dddgfd edd%ddddgfdedd%dd%ddgfd!edd"dd%ddgfd#edd"dd%ddgfd$edd%dd"ddgfg Z RS(&s.Tests options that may or may not be argumentss-xR=s-3RRRRRs-y2.5s-xas-x -as-x -3s-x -3.5s-3 -3.5s-x -2.5s -x -2.5 as-3 -.5sa x -1s-x -1 as-3 -1 aRRs-x 2.5g@s-x 2.5 aRs-3.5g?s-3-.5gs-3 .5sa -3.5sa -x 1g?s-x 1 as-3 1 aN( RRRR4tfloatRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs&   !!!!!tTestDefaultSuppressc BseZdZeddddejeddddejeddd dejgZd gZd efd edd fd edd ddgfdede fdedd de fdedd ddgde fgZ RS(s%Test actions with suppressed defaultsRiRRRRRs--bazRRs-xRRsa bRRsa --bazs --baz a b( RRRR4targparsetSUPPRESSRfRR8R&R(((s./usr/local/lib/python2.7/test/test_argparse.pyR! s  tTestParserDefaultSuppressc BseZdZedejZedddedddeddd gZd gZd e fd e dd fd e dd ddgfde de fde dd de fde dd ddgde fgZ RS(s4Test actions with a parser-level default of SUPPRESStargument_defaultRiRRRRs--bazRRs-xRRsa bRRsa --bazs --baz a b( RRRR4R"R#RbRfRR8R&R(((s./usr/local/lib/python2.7/test/test_argparse.pyR$s  tTestParserDefault42c BseZdZeddddZedddeddd ed d d gZd gZdeddddddfdeddddddfdeddddgddfd edddddefdedddddefdeddddgdefgZ RS(s.Test actions with a parser-level default of 42R%i*tversions1.0RiRRRRs--bazRRs-xRRRsa bRsa --bazs --baz a b( RRRR4RbRfRR8R&R(((s./usr/local/lib/python2.7/test/test_argparse.pyR&1s !tTestArgumentsFromFilecBsdeZdZdZeddZedededddgZd d d d d gZdedddd ddgfdedddd dddgfdedddddd gfdedddd ddgfdedddddddgfdedddd dddgfdd d dgedd dd ddgfgZ RS(s"Test reading arguments from a filecCsctt|jdd d g}x:|D]2\}}t|d}|j||jq)WdS( Nthellos hello world! t recursives -a A @hellotinvalids@no-such-path R,(R)s hello world! (R*s -a A @hello(R+s@no-such-path (RR(RR-R.tclose(R t file_textsR ttextR2((s./usr/local/lib/python2.7/test/test_argparse.pyRHs  tfromfile_prefix_charst@s-aRRRRRs-bRs@invalids@missingsX YRRs X -a A Y ZRRs@hello Xs hello world!sX @hellos-a B @recursive Y ZsX @recursive Z -a BRN( RRRRR4RbRfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyR(Es   !$!!$$tTestArgumentsFromFileConvertercBs~eZdZdZdefdYZeZeddZedddgZ gZ d e dd d d gfgZ RS( s"Test reading arguments from a filecCs]tt|jdg}x:|D]2\}}t|d}|j||jq#WdS(NR)s hello world! R,(shellos hello world! (RR1RR-R.R,(R R-R R.R2((s./usr/local/lib/python2.7/test/test_argparse.pyRks   tFromFileConverterArgumentParsercBseZdZRS(ccs2x+|jD]}|js%q n|Vq WdS(N(Rtstrip(R targ_linetarg((s./usr/local/lib/python2.7/test/test_argparse.pytconvert_arg_line_to_argsws (RRR6(((s./usr/local/lib/python2.7/test/test_argparse.pyR2usR/R0RRRs@hello XR)sworld!R( RRRRR]R2RcR4RbRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyR1hs tTestFileTypeReprcBseZdZdZRS(cCs)tjd}|jdt|dS(Ntrs FileType('r')(R"tFileTypeR R(R R=((s./usr/local/lib/python2.7/test/test_argparse.pyttest_rscCs,tjdd}|jdt|dS(NtwbisFileType('wb', 1)(R"R9R R(R R=((s./usr/local/lib/python2.7/test/test_argparse.pyt test_wb_1s(RRR:R<(((s./usr/local/lib/python2.7/test/test_argparse.pyR7s tRFilecBs&eZiZdZdZdZRS(cCs ||_dS(N(R*(R R*((s./usr/local/lib/python2.7/test/test_argparse.pyR7scCs||jkr|j|}n!|j}|j|<|jt|tsa|jd}n|j|jko||kSS(Ntascii(tseentreadR,RORtdecodeR*(R RCR.((s./usr/local/lib/python2.7/test/test_argparse.pyRDs N(RRR?R7RFRGRD(((s./usr/local/lib/python2.7/test/test_argparse.pyR=s t TestFileTypeRc BseZdZdZeddejeddejdgZdddgZde d dde dfd e d e dde d fd e d e dde d fd e d e j de j fde d dde dfgZRS(s8Test the FileType option/argument type for reading filescCsstt|jxLddgD]>}ttjj|j|d}|j||j q W|j ddS(NRiRR,treadonly( RRBRR-RR R!RR.R,R3(R t file_nameR2((s./usr/local/lib/python2.7/test/test_argparse.pyRs ! s-xR=RR8s-x barsnon-existent-file.txtRiRs -x foo barRs bar -x foos-x - -RCN(RRRRR4R"R9RfRR8RFR=RPtstdinR(((s./usr/local/lib/python2.7/test/test_argparse.pyRBs $$tTestFileTypeDefaultscBsbeZdZdZeddejdddgZdgZde d e d fgZ RS( s<Test that a file is not created unless the default is neededcCsOtt|jttjj|jdd}|jd|j dS(NtgoodR,( RRFRR-RR R!RR.R,(R R2((s./usr/local/lib/python2.7/test/test_argparse.pyRs! s-cR=R8Rs no-file.txtRs-c goodRRG( RRRRR4R"R9RfRR8R=R(((s./usr/local/lib/python2.7/test/test_argparse.pyRFs  $ tTestFileTypeRBc BseZdZdZeddejdeddejdgZddgZde dd de dfd e de dde d fd e de dde d fd e de j de j fgZRS(s8Test the FileType option/argument type for reading filescCsftt|jxLddgD]>}ttjj|j|d}|j||j q WdS(NRiRR,( RRHRR-RR R!RR.R,(R RDR2((s./usr/local/lib/python2.7/test/test_argparse.pyRs ! s-xR=trbRs-x barRiRs -x foo barRs bar -x foos-x - -N(RRRRR4R"R9RfRR8RFR=RPRER(((s./usr/local/lib/python2.7/test/test_argparse.pyRHs  $$tWFilecBs)eZeZdZdZdZRS(cCs ||_dS(N(R*(R R*((s./usr/local/lib/python2.7/test/test_argparse.pyR7scCsp||jkr`d}d|jkr6|jd}n|j||j|jj|n|j|jkS(NsCheck that file is writable.RR>(R?tmodetencodeR.R,taddR*(R RCR.((s./usr/local/lib/python2.7/test/test_argparse.pyRDs  N(RRRR?R7RFRGRD(((s./usr/local/lib/python2.7/test/test_argparse.pyRJs  tgeteuidisnon-root user requiredt TestFileTypeWc BseZdZdZeddejdeddejdgZddgZdddgZde d dde dfd e d e dde d fd e d e dde d fd e d e j de j fgZRS(s8Test the FileType option/argument type for writing filescCs$tt|j|jddS(NRC(RRORR3(R ((s./usr/local/lib/python2.7/test/test_argparse.pyRss-xR=R,Rs-x barRCRiRs -x foo barRs bar -x foos-x - -N(RRRRR4R"R9RfRR8RFRJRPRKR(((s./usr/local/lib/python2.7/test/test_argparse.pyROs  $$tTestFileTypeWBc BseZeddejdeddejdgZddgZdedd de dfdede dde dfd ede dde dfd ede j de j fgZ RS( s-xR=R;Rs-x barRiRs -x foo barRs bar -x foos-x - -N( RRR4R"R9RfRR8RFRJRPRKR(((s./usr/local/lib/python2.7/test/test_argparse.pyRPs $$tTestTypeCallablecBseZdZeddeeddegZddddgZded d dd fd ed d ddfded dddfgZ RS(s,Test some callables as option/argument typess--eggsR=RRt42js--eggs as --eggs 2is --eggs=42 42teggsi*gE@s--eggs 2j -- -1.5y@gs1024.675g3333@N( RRRR4tcomplexR RfRR8RFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRQ"stTestTypeUserDefinedcBseZdZdefdYZeddeeddegZgZdededded fd eded ded fgZ RS( s(Test a user-defined option/argument typetMyTypecBs eZdZdZdZRS(cCs ||_dS(N(tvalue(R RW((s./usr/local/lib/python2.7/test/test_argparse.pyR76scCs(t||jft||jfkS(N(R=RW(R RC((s./usr/local/lib/python2.7/test/test_argparse.pyRD;sN(RRR7RFRGRD(((s./usr/local/lib/python2.7/test/test_argparse.pyRV4s s-xR=Rsa -x bRRRs-xf gRR( RRRRRVR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRU1s $tTestTypeClassicClasscBseZdZdd dYZeddeeddegZgZdededded fd eded ded fgZRS(sTest a classic class typetCcBs eZdZdZdZRS(cCs ||_dS(N(RW(R RW((s./usr/local/lib/python2.7/test/test_argparse.pyR7NscCs(t||jft||jfkS(N(R=RW(R RC((s./usr/local/lib/python2.7/test/test_argparse.pyRDSsN(RRR7RFRGRD(((s./usr/local/lib/python2.7/test/test_argparse.pyRYLs s-xR=Rsa -x bRRRs-xf gRR(( RRRRYR4RfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRXIs $tTestTypeRegistrationcBseZdZdZRS(s*Test a user-defined type by registering itcCsd}tj}|jdd||jddd|jddd|j|jdjtdddd|j|jd jtdddd dS( NcSsd|S(Ns my_type{%s}((tstring((s./usr/local/lib/python2.7/test/test_argparse.pyt get_my_typefsR=tmy_types-xRRRs my_type{1}s-x 1 42s my_type{42}( R"tArgumentParsertregisterRdR RWRR8RF(R R\Re((s./usr/local/lib/python2.7/test/test_argparse.pyttestds  (RRRR`(((s./usr/local/lib/python2.7/test/test_argparse.pyRZastTestActionUserDefinedc BseZdZdejfdYZdejfdYZedddded ed d ed ded e d dd dgZ gZ de ddd dfde dd d dfde ddd dfde ddd dfgZ RS(s*Test a user-defined option/argument actiontOptionalActioncBseZddZRS(cCsyStdd}|d kr*d|_n(|d krBd|_ntd|Wn1tk rtjd }td |nXt|d|dS( NRg?g?g?ig@iTs value: %sisopt_action failed: %s(g?g?(g@(R8RtAssertionErrorRPRTRHRS(R Ret namespaceRWt option_stringRte((s./usr/local/lib/python2.7/test/test_argparse.pyt__call__}s     N(RRRFRg(((s./usr/local/lib/python2.7/test/test_argparse.pyRb{stPositionalActioncBseZddZRS(cCsyktdd}|d kr*d|_n@|d krBd|_n(|d krZd|_ntd |Wn1tk rtjd}td |nXt|d|dS(NRii*iTg?ig?g?s value: %ssarg_action failed: %s(i*iT(i(i(R8RRcRPRTRHRS(R ReRdRWReRRf((s./usr/local/lib/python2.7/test/test_argparse.pyRgs       N(RRRFRg(((s./usr/local/lib/python2.7/test/test_argparse.pyRhss-sRRRR=Rg?RRRis-s0.125g?Ri*s -s 0.625 1g?is84 -s2g@iT(RRRR"tActionRbRhR4R RRfRR8R(((s./usr/local/lib/python2.7/test/test_argparse.pyRaxs tTestActionRegistrationcBs0eZdZdejfdYZdZRS(s5Test a user-defined action supplied by registering ittMyActioncBseZddZRS(cCst||jd|dS(Nsfoo[%s](RSR(R ReRdtvaluesRe((s./usr/local/lib/python2.7/test/test_argparse.pyRgsN(RRRFRg(((s./usr/local/lib/python2.7/test/test_argparse.pyRkscCstj}|jdd|j|jddd|j|jdgtdd|j|jdgtdddS(NRt my_actionRRsfoo[1]Rsfoo[42](R"R^R_RkRdR RWR8(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyR`s  %(RRRR"RiRkR`(((s./usr/local/lib/python2.7/test/test_argparse.pyRjstTestAddSubparserscBseZdZdZeddZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZRS(sTest the add_subparsers methodcOs|jt||dS(N(RRH(R R5R6((s./usr/local/lib/python2.7/test/test_argparse.pytassertArgumentParserErrorsc Cs|rItddddd|}|j|dddd d d d n.tdddd}|jd d d d d |jddtd d|jd d}|j|jtdd}|rd|d |jdtj}|j}|j|tj|dS(NR(RRRtusage_when_not_requiredR RR(R Rtexpected_usage((s./usr/local/lib/python2.7/test/test_argparse.pyttest_usage_when_not_requireds cCs>|jdtj}|j}|j|tj|dS(NR(RR&Rtusage_when_requiredR RR(R RR((s./usr/local/lib/python2.7/test/test_argparse.pyttest_usage_when_requireds cCsE|jdtj}|j|j}|j|tj|dS(NR(RRRRRsR RR(R RRs((s./usr/local/lib/python2.7/test/test_argparse.pyttest_help_when_not_requiredscCsE|jdtj}|j|j}|j|tj|dS(NR(RR&RRRsR RR(R RRs((s./usr/local/lib/python2.7/test/test_argparse.pyttest_help_when_required s( RRRRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs       tTestMutuallyExclusiveSimplec BseZddZddgZdeddddfdeddddfd edddd fd eddddfgZd eddddfgZd ZdZ dZ RS(cCsWtdd}|jd|}|jddd|jddd d d dd |S( NRpRqRs--barRssbar helps--bazRRRRsbaz help(R]RRd(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyR s s--bar X --baz Ys --bar X --bazs--bar XRRRs--bar X --bar ZRs--baz YRs--bazRs; usage: PROG [-h] [--bar BAR | --baz [BAZ]] s; usage: PROG [-h] (--bar BAR | --baz [BAZ]) s optional arguments: -h, --help show this help message and exit --bar BAR bar help --baz [BAZ] baz help N( RRRFRRR8RRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR s  tTestMutuallyExclusiveLongc BseZddZdgZdeddddddddfdedd ddddddfd eddddddddfd edddd ddddfgZd eddddddddfgZd ZdZ dZ RS(cCsqtdd}|jddd|jddd|jd|}|jd dd |jd dd |S( NRpRqs--abcdeRss abcde helps--fghijs fghij helpRs--klmnos klmno helps--pqrsts pqrst help(R]RdR(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyR, ss--klmno X --pqrst Ys --klmno XtabcdetfghijtklmnoRtpqrsts--abcde Y --klmno XRs --pqrst Xs--pqrst X --fghij YRsi usage: PROG [-h] [--abcde ABCDE] [--fghij FGHIJ] [--klmno KLMNO | --pqrst PQRST] si usage: PROG [-h] [--abcde ABCDE] [--fghij FGHIJ] (--klmno KLMNO | --pqrst PQRST) s optional arguments: -h, --help show this help message and exit --abcde ABCDE abcde help --fghij FGHIJ fghij help --klmno KLMNO klmno help --pqrst PQRST pqrst help N( RRRFRRR8RRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR* s $!$'* t$TestMutuallyExclusiveFirstSuppressedcBseZdZdgZdedddefdedddefdedd defgZd edd defgZ d Z d Z d Z RS(cCsTtdd}|jd|}|jddtj|jddddd |S( NRpRqRs-xRss-yRRsy help(R]RRdR"R#(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyRW s s-x X -ys-x XRRRs -x X -x YRs-yRs& usage: PROG [-h] [-y] s$ usage: PROG [-h] -y sx optional arguments: -h, --help show this help message and exit -y y help N( RRRRR8R&RFRRRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyRU s  t#TestMutuallyExclusiveManySuppressedc BseZdZdddgZdedededdfdedededdfd edededd fd edededdfgZd edededdfgZ d Z Z dZ RS(cCsstdd}|jd|}|j}|ddddtj|ddd dtj|d dtj|S( NRpRqRs--spamRRRss--badgerRs --bladder(R]RRdR"R#(R RReRkRM((s./usr/local/lib/python2.7/test/test_argparse.pyRx s s--spam --badgers--badger --bladder Bs--bladder B --spams--spamRRtbladders--badgers --bladder BRs --spam --spamRs! usage: PROG [-h] s[ optional arguments: -h, --help show this help message and exit N( RRRRR8R&RFRRRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyRv s  $$ t*TestMutuallyExclusiveOptionalAndPositionalc BseZdZdddddgZdededdd d fd ededd d d fd ededdd d gfd ededdd d ddgfgZdededdd d fgZ dZ dZ dZ RS(cCsptdd}|jd|}|jddddd|jd dd |jd d d dddd|S(NRpRqRs--fooRRRstFOOs--spamtSPAMRRRRRtBADGER(R]RRd(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyR s s--foo --spam Ss --spam S XsX --foosX Y Z --spam Ss --foo X Ys--fooRiRRRs--spam StSsX Y ZRRRsM usage: PROG [-h] [--foo | --spam SPAM | badger [badger ...]] sM usage: PROG [-h] (--foo | --spam SPAM | badger [badger ...]) s positional arguments: badger BADGER optional arguments: -h, --help show this help message and exit --foo FOO --spam SPAM SPAM N( RRRRR8R&RFRRRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR s  !-$ t#TestMutuallyExclusiveOptionalsMixedcBseZdZddddgZdedededed ed efd edededed ed efd edededed ed efd edededed ed efdedededed ed efdedededed ed efgZdedededed ed efdedededed ed efdedededed ed efgZdZ Z dZ RS(cCstdd}|jddddd|jd|}|jd dddd |jd dddd |jd dddd|jddddd|S(NRpRqs-xRRRssx helpRs-asa helps-bsb helps-ysy helps-csc help(R]RdR(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyR ss-a -bs-b -cs-a -cs-a -b -cs-aRRRRRs-bs-cs-a -xs-y -bs-x -y -cRs-xs-ys: usage: PROG [-h] [-x] [-a] [-b] [-y] [-c] s optional arguments: -h, --help show this help message and exit -x x help -a a help -b b help -y y help -c c help ( RRRRR8R&RRRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR s *****0**0 tTestMutuallyExclusiveInGroupcBseZd dZddgZdedddd fdedd ddfgZd edd dd fgZd Zd Z d Z RS(cCsctdd}|jdddd}|jd|}|jdd d |jd d d |S( NRpRqRs Titled groupRrsGroup descriptionRs--barRssbar helps--bazsbaz help(R]RjRRd(R RRet titled_groupt mutex_group((s./usr/local/lib/python2.7/test/test_argparse.pyR s s--bar X --baz Ys--baz X --bar Ys--bar XRRRs--baz YRRs9 usage: PROG [-h] [--bar BAR | --baz BAZ] s9 usage: PROG [-h] (--bar BAR | --baz BAZ) s optional arguments: -h, --help show this help message and exit Titled group: Group description --bar BAR bar help --baz BAZ baz help N( RRRFRRR8RRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR s  t1TestMutuallyExclusiveOptionalsAndPositionalsMixedcBsbeZdZdddgZdedddeded d d efd edddeded d d efd edddeded d d efdedddeded d d efdedddeded d d efgZd edddeded d d efdedddeded d d efgZ dZ Z dZ RS(cCstdd}|jddd|jddddd |jd |}|jd d d dd|jddddd|jddddd|S(NRpRqRRssx helps-yRRsy helpRRRRsa helps-bsb helps-csc help(R]RdR(R RReRk((s./usr/local/lib/python2.7/test/test_argparse.pyR ssX A -bs-b -cs-c X AsX ARRRRRRRsX -bsX -csX A -ysX -y -bsX -ys6 usage: PROG [-h] [-y] [-b] [-c] x [a] s  positional arguments: x x help a a help optional arguments: -h, --help show this help message and exit -y y help -b b help -c c help N( RRRRR8RRFR&RRRRRs(((s./usr/local/lib/python2.7/test/test_argparse.pyR s ****0*0 tMEPBasecBseZddZRS(cCs@tt|jd|}td|jdtd|g}|S(NRRpRR(RRRR]RpR(R RRRe((s./usr/local/lib/python2.7/test/test_argparse.pyRH sN(RRRFR(((s./usr/local/lib/python2.7/test/test_argparse.pyRF st&TestMutuallyExclusiveGroupErrorsParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRO st!TestMutuallyExclusiveSimpleParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRT stTestMutuallyExclusiveLongParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRY st*TestMutuallyExclusiveFirstSuppressedParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyR^ st)TestMutuallyExclusiveManySuppressedParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRc st0TestMutuallyExclusiveOptionalAndPositionalParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRh st)TestMutuallyExclusiveOptionalsMixedParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRm st7TestMutuallyExclusiveOptionalsAndPositionalsMixedParentcBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRr stTestSetDefaultscBs>eZdZdZdZdZdZdZRS(c Cst}|jdd|jdddd|jtdddddd|jg|jtdddddd|jgt|jtdddddd|jgtdd|jtdddddd|jgtdddddS( NRRiRRRiRi(R]t set_defaultsR R8RW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_set_defaults_no_args| s cCs\t}|jdddd|jddd|jtdddd|jg|jtdddd|jgt|jtdddd|jgtdd|jtdd dd|jd j|jtdd dd|jd jt|jtdd dd|jd jtdddS( NRRiRRs-xRtxfooxRRs-x 1(R]RRdR R8RWR(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_set_defaults_with_args s cCsvt}|jdd|j}|jd}|jdd|jtdddd|jdjdS(NRRiRRR(R]RRxRzR R8RWR(R ReR|tparser_a((s./usr/local/lib/python2.7/test/test_argparse.pyttest_set_defaults_subparsers s  cCsWtdt}|jddtd|g}|jtdd|jgdS(NRRRiR(R]RRR R8RW(R RRe((s./usr/local/lib/python2.7/test/test_argparse.pyttest_set_defaults_parents sc Cst}|jdddddddd|jd |jd d d |jdd d|jdd dd d|jtdddd dddd|jg|jdddddddd|jtdddddddd|jgdS(NR,tWRRRRRRs-ws-xRtXXRRtZZtWWtYY(R]RRdR R8RW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyt&test_set_defaults_same_as_add_argument s " $"$c Cst}|jdddddddd|jd }|jd |jd d d |jddd|jdddd d|jtdddd dddd|jg|jdddddddd|jtdddddddd|jgdS(NR,RRRRRRRRis-ws-xRRRRRRR(R]RRjRdR R8RW(R ReRk((s./usr/local/lib/python2.7/test/test_argparse.pyt,test_set_defaults_same_as_add_argument_group s " $"$(RRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRz s    tTestGetDefaultcBseZdZRS(cCs t}|jd|jd|jd|jd|jd|jd|jd|jd|jd|jddtdd|jd|jd|jd|jd|jdd|jd|jd|jd|jddS( NRiRs--foos--barR=Ri*R(R]R RFt get_defaultRdRR(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_get_default s  (RRR (((s./usr/local/lib/python2.7/test/test_argparse.pyR stTestNamespaceContainsSimplecBseZdZdZRS(cCsRtj}|jd|kt|jd|kt|jd|ktdS(NRR(R"t NamespaceR RR&(R tns((s./usr/local/lib/python2.7/test/test_argparse.pyt test_empty s cCstjdddd}|jd|kt|jd|kt|jd|kt|jd|kt|jd|kt|jd|ktdS(NRiRiRtxxR(R"R R R&R(R R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_non_empty s(RRR R(((s./usr/local/lib/python2.7/test/test_argparse.pyR  s tTestHelpFormattingMetaclasscBseZdZRS(cCsZ|dkrdSdtfdY}x-d d d gD]\}}||||q6WdS( Nt HelpTestCaseRtcBs>eZdZdZdZdZdZdZRS(cSs||_||_xp|j|j|jgD]V}d|j|f}|d}y ||_Wntk rpnXt|||q+WdS(Ns%s_%scSs||dS(N((R Rv((s./usr/local/lib/python2.7/test/test_argparse.pyt test_wrapper s(t func_suffixtstd_namet test_formatt test_printttest_print_fileRR|RS(R t test_classRRRvRR((s./usr/local/lib/python2.7/test/test_argparse.pyR7 s      c Ss tj|jj|jj}x0t|dgD]}|j|j|jq1Wt|dg}xS|D]K\}}|j|j|j}x$|D]}|j|j|jqWqjWt|dg}|r|j} x'|D]} | j | j| jqWn|S(NRftargument_group_signaturestsubparsers_signatures( R"R^RbR5R6RRRdRjRxRz( R RRet argument_sigt group_sigst group_sigt argument_sigsRktsubparsers_sigsR|t subparser_sig((s./usr/local/lib/python2.7/test/test_argparse.pyR s(         cSst||j}tj|}||krt|GHt|GHx?t||D]+\}}||krSd||fGHPqSqSWn|j||dS(Nsfirst diff: %r %r(RRRRRRtzipR (R Rt parser_textt expected_texttchar1tchar2((s./usr/local/lib/python2.7/test/test_argparse.pyt_test, s     cSs<|j|}t|d|j}|j||dS(Ns format_%s(RRRRR&(R RReR((s./usr/local/lib/python2.7/test/test_argparse.pyR8 scSs|j|}t|d|j}tt|j}tt|jtz#|tt|jj}Wdtt|j|X|j||dS(Nsprint_%s( RRRRRPRRSRRVR&(R RRetprint_t old_streamR"((s./usr/local/lib/python2.7/test/test_argparse.pyR= scSsX|j|}t|d|j}t}|||j}|j||dS(Nsprint_%s(RRRRRRVR&(R RReR'tsfileR"((s./usr/local/lib/python2.7/test/test_argparse.pyRI s    (RRR7RR&RRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRt s     tusageRKRsR'RL(susagesstdout(shelpsstdout(sversionsstderr(R(RR*RRRtRR((s./usr/local/lib/python2.7/test/test_argparse.pyR7 s O(RRR7(((s./usr/local/lib/python2.7/test/test_argparse.pyR sRtTestHelpBiggerOptionalsc BseZdZeddddddddZed d d d d edd dedd dedd dgZgZdZedZdZ RS(s;Make sure that argument help aligns when options are longerRpRqRrt DESCRIPTIONtepilogtEPILOGR's0.1s-xRRRssX HELPs--ysY HELPRisFOO HELPRsBAR HELPs; usage: PROG [-h] [-v] [-x] [--y Y] foo bar sb DESCRIPTION positional arguments: foo FOO HELP bar BAR HELP optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -x X HELP --y Y Y HELP EPILOG s 0.1 ( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR+[ stTestShortColumnscBsKeZdZdZejZejZejZdZedZ ej Z RS(sTest extremely small number of columns. TestCase prevents "COLUMNS" from being too small in the tests themselves, but we don't want any exceptions thrown in such case. Only ugly representation. cCs0tj}|jdd|j|jdS(NR R(RRRRR(R R((s./usr/local/lib/python2.7/test/test_argparse.pyR s s usage: PROG [-h] [-v] [-x] [--y Y] foo bar s DESCRIPTION positional arguments: foo FOO HELP bar BAR HELP optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -x X HELP --y Y Y HELP EPILOG ( RRRRR+RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR/~ s    tTestHelpBiggerOptionalGroupsc BseZdZeddddddddZed d d d d edd dedd dedd dgZedddedd dedddd dgfgZdZedZdZ RS(s;Make sure that argument help aligns when options are longerRpRqRrR,R-R.R's0.1s-xRRRssX HELPs--ysY HELPRisFOO HELPRsBAR HELPs GROUP TITLEsGROUP DESCRIPTIONRsBAZ HELPs-zRRsZ HELPsN usage: PROG [-h] [-v] [-x] [--y Y] [-z Z [Z ...]] foo bar baz s DESCRIPTION positional arguments: foo FOO HELP bar BAR HELP optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -x X HELP --y Y Y HELP GROUP TITLE: GROUP DESCRIPTION baz BAZ HELP -z Z [Z ...] Z HELP EPILOG s 0.1 ( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR0 s!tTestHelpBiggerPositionalscBseZdZeddddZeddddd ed dd ed dd edddgZgZdZedZdZ RS(s4Make sure that help aligns when arguments are longerR*tUSAGERrR,s-xRRRssX HELPs--ysY HELPtekiekiekifekangsEKI HELPRsBAR HELPs usage: USAGE s  DESCRIPTION positional arguments: ekiekiekifekang EKI HELP bar BAR HELP optional arguments: -h, --help show this help message and exit -x X HELP --y Y Y HELP R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR1 s tTestHelpReformattingcBseZdZeddddZeddddd ed dd dd gZed ddedddddgfgZdZedZdZ RS(s>Make sure that text after short names starts on the first lineRpRqRrse oddly formatted description that is so long that it should go onto multiple lines when wrappeds-xtmetavarRRssoddly formatted -x helpRRs normal y helpRs' oddly formatted group descriptions-aRRs` oddly formatted -a help again, so long that it should be wrapped over multiple liness2 usage: PROG [-h] [-x XX] [-a] yyy s oddly formatted description that is so long that it should go onto multiple lines when wrapped positional arguments: yyy normal y help optional arguments: -h, --help show this help message and exit -x XX oddly formatted -x help title: oddly formatted group description -a oddly formatted -a help again, so long that it should be wrapped over multiple lines R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR4 s tTestHelpWrappingShortNamescBseZdZedddddZedddd d d ed dd d dd gZededddd ddgfgZdZedZdZ RS(s>Make sure that text after short names starts on the first lineRpRqRrsD Dis-xR5RRssXHH HXiRRsYH YHtALPHASs-aRRsAHHH HHAi s2 usage: PROG [-h] [-x XX] [-a] yyy s D DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD D positional arguments: yyy YH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YH optional arguments: -h, --help show this help message and exit -x XX XHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HXXHH HX ALPHAS: -a AHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHAAHHH HHA R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR66 s %tTestHelpWrappingLongNamesc BseZdZeddddddddZedd d d d d dedd dd d ddgZededd dd d ddedd dd d ddgfgZdZedZdZ RS(s<Make sure that text after long names starts on the next lineR*R2RrsD DiR'sV Vs-xR5RiRssXH XHiRsYH YHR7s-aRsAH AHRsZH ZHs usage: USAGE sr D DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD D positional arguments: yyyyyyyyyyyyyyyyyyyyyyyyy YH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YHYH YH optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -x XXXXXXXXXXXXXXXXXXXXXXXXX XH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XHXH XH ALPHAS: -a AAAAAAAAAAAAAAAAAAAAAAAAA AH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AHAH AH zzzzzzzzzzzzzzzzzzzzzzzzz ZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZHZH ZH ss V VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV VV V ( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR8^ s # )t TestHelpUsagec BseZdZeddZedddddeddd dd ed dd ed dd dd edddddgZededddddedddddeddddd edddddgfgZdZedZdZ RS(sTest basic usage messagesRpRqs-wRRRsR,s-xRRRRiRRRks-yRs-ziRRRfs usage: PROG [-h] [-w W [W ...]] [-x [X [X ...]]] [-y [Y]] [-z Z Z Z] a b b [c] [d [d ...]] e [e ...] s positional arguments: a a b b c c optional arguments: -h, --help show this help message and exit -w W [W ...] w -x [X [X ...]] x group: -y [Y] y -z Z Z Z z d d e e R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR9 s  !tTestHelpOnlyUserGroupscBseZdZedddeZgZededddedddgfed ed dd ed dd gfgZd ZedZ dZ RS(sTest basic usage messagesRpRqRtxxxxs-xRsRRtyyyyRs-yRs. usage: PROG [-x X] [-y Y] a b sn xxxx: -x X x a a yyyy: b b -y Y y R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR: s   tTestHelpUsageLongProgcBsseZdZedddZedddeddded ed gZgZd Zed Zd Z RS(s*Test usage messages where the prog is longRptPi<s-wR5Rs-xRRRsz usage: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP [-h] [-w W] [-x X] a b s positional arguments: a b optional arguments: -h, --help show this help message and exit -w W -x X R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR= s  t TestHelpUsageLongProgOptionsWrapcBseZdZedddZeddddeddd ded dd ded dd dededgZgZdZedZdZ RS(sATest usage messages where the prog is long and the optionals wrapRpR>i<s-wR5Ris-xRs-yRs-zRRRs usage: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP [-h] [-w WWWWWWWWWWWWWWWWWWWWWWWWW] [-x XXXXXXXXXXXXXXXXXXXXXXXXX] [-y YYYYYYYYYYYYYYYYYYYYYYYYY] [-z ZZZZZZZZZZZZZZZZZZZZZZZZZ] a b s8 positional arguments: a b optional arguments: -h, --help show this help message and exit -w WWWWWWWWWWWWWWWWWWWWWWWWW -x XXXXXXXXXXXXXXXXXXXXXXXXX -y YYYYYYYYYYYYYYYYYYYYYYYYY -z ZZZZZZZZZZZZZZZZZZZZZZZZZ R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR? s  t$TestHelpUsageLongProgPositionalsWrapcBspeZdZeddddeZeddeddeddgZgZd Zed Z d Z RS( sCTest usage messages where the prog is long and the positionals wrapRpR>i<RRiRRs usage: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc s positional arguments: aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR@ s  tTestHelpUsageOptionalsWrapcBseZdZeddZeddddedddded dd ded dd ded ededgZgZdZedZdZ RS(s,Test usage messages where the optionals wrapRpRqs-wR5Ris-xRs-yRs-zRRRRs usage: PROG [-h] [-w WWWWWWWWWWWWWWWWWWWWWWWWW] [-x XXXXXXXXXXXXXXXXXXXXXXXXX] [-y YYYYYYYYYYYYYYYYYYYYYYYYY] [-z ZZZZZZZZZZZZZZZZZZZZZZZZZ] a b c sD positional arguments: a b c optional arguments: -h, --help show this help message and exit -w WWWWWWWWWWWWWWWWWWWWWWWWW -x XXXXXXXXXXXXXXXXXXXXXXXXX -y YYYYYYYYYYYYYYYYYYYYYYYYY -z ZZZZZZZZZZZZZZZZZZZZZZZZZ R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRA9 s   tTestHelpUsagePositionalsWrapcBseZdZeddZededededdedded dgZgZd Zed Zd Z RS( s.Test usage messages where the positionals wrapRpRqs-xs-ys-zRiRRs usage: PROG [-h] [-x X] [-y Y] [-z Z] aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc s positional arguments: aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc optional arguments: -h, --help show this help message and exit -x X -y Y -z Z R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRB_ s      t%TestHelpUsageOptionalsPositionalsWrapcBseZdZeddZeddddedddded dd ded ded ded dgZgZdZedZdZ RS(s<Test usage messages where the optionals and positionals wrapRpRqs-xR5Ris-yRs-zRRRRs usage: PROG [-h] [-x XXXXXXXXXXXXXXXXXXXXXXXXX] [-y YYYYYYYYYYYYYYYYYYYYYYYYY] [-z ZZZZZZZZZZZZZZZZZZZZZZZZZ] aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc se positional arguments: aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc optional arguments: -h, --help show this help message and exit -x XXXXXXXXXXXXXXXXXXXXXXXXX -y YYYYYYYYYYYYYYYYYYYYYYYYY -z ZZZZZZZZZZZZZZZZZZZZZZZZZ R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRC s   tTestHelpUsageOptionalsOnlyWrapcBsxeZdZeddZeddddedddded dd dgZgZd Zed Zd Z RS(s@Test usage messages where there are only optionals and they wrapRpRqs-xR5Ris-yRs-zRs usage: PROG [-h] [-x XXXXXXXXXXXXXXXXXXXXXXXXX] [-y YYYYYYYYYYYYYYYYYYYYYYYYY] [-z ZZZZZZZZZZZZZZZZZZZZZZZZZ] s optional arguments: -h, --help show this help message and exit -x XXXXXXXXXXXXXXXXXXXXXXXXX -y YYYYYYYYYYYYYYYYYYYYYYYYY -z ZZZZZZZZZZZZZZZZZZZZZZZZZ R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRD st TestHelpUsagePositionalsOnlyWrapcBsleZdZedddeZeddeddeddgZgZdZed Z d Z RS( sBTest usage messages where there are only positionals and they wrapRpRqRRiRRs~ usage: PROG aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc s positional arguments: aaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRE s  tTestHelpVariableExpansionc BseZdZeddZeddeddeddd d d d d ddedddddedd ddddgddddedddedd dddgZeded dd!ed"d d#dd$gfgZd%Zed&Z d'Z RS((s:Test that variables are expanded properly in help messagesRpRqs-xR=Rss"x %(prog)s %(default)s %(type)s %%s-yRRRi*RtXXXs y %(prog)s %(default)s %(const)ss--fooRRs$foo %(prog)s %(default)s %(choices)ss--barRiiR5tBBBs!bar %(prog)s %(default)s %(dest)sRsspam %(prog)s %(default)sRg?sbadger %(prog)s %(default)sRks-asa %(prog)s %(default)ss-bisb %(prog)s %(default)ssw usage: PROG [-h] [-x X] [-y] [--foo {a,b,c}] [--bar BBB] [-a A] [-b B] spam badger s positional arguments: spam spam PROG None badger badger PROG 0.5 optional arguments: -h, --help show this help message and exit -x X x PROG None int % -y y PROG 42 XXX --foo {a,b,c} foo PROG None a, b, c --bar BBB bar PROG baz bar group: -a A a PROG None -b B b PROG -1 R( RRRR4RbRRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRF s&! !t&TestHelpVariableExpansionUsageSuppliedcBsEeZdZeddddZgZgZdZedZdZ RS(s@Test that variables are expanded properly when usage= is presentRpRqR*s %(prog)s FOOs usage: PROG FOO s[ optional arguments: -h, --help show this help message and exit R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRIst$TestHelpVariableExpansionNoArgumentscBsAeZdZedddeZgZgZdZeZ dZ RS(s;Test that variables are expanded properly with no argumentsRpRqRs usage: PROG R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRJstTestHelpSuppressUsagecBsbeZdZedddejZedddedddgZgZd Z d Z d Z RS( s3Test that items can be suppressed in usage messagesRpRqR*s--fooRssfoo helpRs spam helps positional arguments: spam spam help optional arguments: -h, --help show this help message and exit --foo FOO foo help R( RRRR4R"R#RbRfRRsR*R'(((s./usr/local/lib/python2.7/test/test_argparse.pyRK#stTestHelpSuppressOptionalcBsfeZdZedddeZeddejedddgZgZ dZ e d Z d Z RS( s?Test that optional arguments can be suppressed in help messagesRpRqRs--fooRsRs spam helps! usage: PROG spam sA positional arguments: spam spam help R( RRRR4RRbR"R#RfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRL8stTestHelpSuppressOptionalGroupcBs~eZdZeddZedddedddgZeded dejgfgZd Z e d Z d Z RS( s<Test that optional groups can be suppressed in help messagesRpRqs--fooRssfoo helpRs spam helpRks--bars2 usage: PROG [-h] [--foo FOO] spam s positional arguments: spam spam help optional arguments: -h, --help show this help message and exit --foo FOO foo help R( RRRR4RbRfR"R#RR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRMLs'tTestHelpSuppressPositionalcBs`eZdZeddZedddeddejgZgZdZ e dZ d Z RS( sATest that positional arguments can be suppressed in help messagesRpRqs--fooRssfoo helpRs- usage: PROG [-h] [--foo FOO] sz optional arguments: -h, --help show this help message and exit --foo FOO foo help R( RRRR4RbR"R#RfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRNfstTestHelpRequiredOptionalcBsTeZdZeddZeddeddgZgZdZedZ d Z RS( s.Test that required options don't look optionalRpRqs--fooRRssfoo helps+ usage: PROG [-h] --foo FOO sz optional arguments: -h, --help show this help message and exit --foo FOO foo help R( RRRR4RbR&RfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRO{stTestHelpAlternatePrefixCharscBsreZdZedddddeZedddd d ed d d d gZgZdZedZ dZ RS(s:Test that options display with different prefix charactersRpRqRs^;Rs^^fooRRRssfoo helps;bs;;barsbar helps- usage: PROG [^^foo] [;b BAR] sq optional arguments: ^^foo foo help ;b BAR, ;;bar BAR bar help R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRPstTestHelpNoHelpOptionalcBsceZdZedddeZedddedddgZgZd Zed Z d Z RS( s=Test that the --help argument can be suppressed help messagesRpRqRs--fooRssfoo helpRs spam helps- usage: PROG [--foo FOO] spam s positional arguments: spam spam help optional arguments: --foo FOO foo help R( RRRR4RRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRQstTestHelpVersionOptionalcBsceZdZeddddZedddeddd gZgZd Zed Zd Z RS( s@Test that the --version argument can be suppressed help messagesRpRqR's1.0s--fooRssfoo helpRs spam helps7 usage: PROG [-h] [-v] [--foo FOO] spam s positional arguments: spam spam help optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit --foo FOO foo help s 1.0 ( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRRs t TestHelpNonecBsQeZdZeddZededgZgZdZedZdZ RS(s1Test that no errors occur if no help is specifiedRpRqs--fooRs2 usage: PROG [-h] [--foo FOO] spam s positional arguments: spam optional arguments: -h, --help show this help message and exit --foo FOO R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRSs tTestHelpTupleMetavarc BseZdZeddZeddddddded dd dd ddedddddddeddddddd gZgZdZedZdZ RS(!s"Test specifying metavar as a tupleRpRqs-wRsR,RRR5tW1tW2s-xRRtX1tX2s-yRitY1tY2tY3s-zRRtZ1s] usage: PROG [-h] [-w W1 [W2 ...]] [-x [X1 [X2 ...]]] [-y Y1 Y2 Y3] [-z [Z1]] s optional arguments: -h, --help show this help message and exit -w W1 [W2 ...] w -x [X1 [X2 ...]] x -y Y1 Y2 Y3 y -z [Z1] z R(RURV(RWRX(RYRZR[(R\( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRTs!tTestHelpRawTextcBseZdZedddejddZeddded dd gZed dd ed ddgfgZdZ e dZ dZ RS(sTest the RawTextHelpFormatterRpRqtformatter_classRrs7Keep the formatting exactly as it is written here s--fooRss- foo help should also appear as given hereRs spam helpRs? This text should be indented exactly like it is here s--barsbar helps> usage: PROG [-h] [--foo FOO] [--bar BAR] spam s Keep the formatting exactly as it is written here positional arguments: spam spam help optional arguments: -h, --help show this help message and exit --foo FOO foo help should also appear as given here title: This text should be indented exactly like it is here --bar BAR bar help R( RRRR4R"tRawTextHelpFormatterRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR] s tTestHelpRawDescriptioncBseZdZedddejddZeddded dd gZed dd ed ddgfgZdZ e dZ dZ RS(sTest the RawTextHelpFormatterRpRqR^Rrs7Keep the formatting exactly as it is written here s--fooRss4 foo help should not retain this odd formattingRs spam helpRs? This text should be indented exactly like it is here s--barsbar helps> usage: PROG [-h] [--foo FOO] [--bar BAR] spam s Keep the formatting exactly as it is written here positional arguments: spam spam help optional arguments: -h, --help show this help message and exit --foo FOO foo help should not retain this odd formatting title: This text should be indented exactly like it is here --bar BAR bar help R( RRRR4R"tRawDescriptionHelpFormatterRbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyR`:s tTestHelpArgumentDefaultsc BseZdZedddejddZedddedd d dd ed dd edddddddgZedddeddeddddgfgZ dZ e dZ dZ RS(s&Test the ArgumentDefaultsHelpFormatterRpRqR^Rrs--fooRss)foo help - oh and by the way, %(default)ss--barRRsbar helpRs spam helpRRRRtwoodens badger helpRs--bazR=i*sbaz helpsO usage: PROG [-h] [--foo FOO] [--bar] [--baz BAZ] spam [badger] s description positional arguments: spam spam help badger badger help (default: wooden) optional arguments: -h, --help show this help message and exit --foo FOO foo help - oh and by the way, None --bar bar help (default: False) title: description --baz BAZ baz help (default: 42) R( RRRR4R"tArgumentDefaultsHelpFormatterRbRfRRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRbjs !'tTestHelpVersionActioncBs]eZdZeddddZeddddddgZgZd Zed Zd Z RS( s,Test the default help for the version actionRpRqRrs-Vs --versionRR's3.6s& usage: PROG [-h] [-V] s description optional arguments: -h, --help show this help message and exit -V, --version show program's version number and exit R( RRRR4RbRfRR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRestTestHelpSubparsersOrderingcBsaeZdZeddddddZgdD]Zed e^q.Zd ZedZdZ RS(s5Test ordering of subcommands in help matches the codeRpRqRrsdisplay some subcommandsR's0.1RRRRRfR*s6 usage: PROG [-h] [-v] {a,b,c,d,e} ... s display some subcommands positional arguments: {a,b,c,d,e} optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit s 0.1 (RRRRRf( RRRR4RbR*RR*RsR'(((s./usr/local/lib/python2.7/test/test_argparse.pyRfs   t"TestHelpSubparsersWithHelpOrderingcBseZdZeddddddZdddddfZgeD]!\ZZedede^qCZdZ e dZdZ RS(s5Test ordering of subcommands in help matches the codeRpRqRrsdisplay some subcommandsR's0.1Rsa subcommand helpRsb subcommand helpRsc subcommand helpRsd subcommand helpRfse subcommand helpR*Rss6 usage: PROG [-h] [-v] {a,b,c,d,e} ... s display some subcommands positional arguments: {a,b,c,d,e} a a subcommand help b b subcommand help c c subcommand help d d subcommand help e e subcommand help optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit s 0.1 (Rsa subcommand help(Rsb subcommand help(Rsc subcommand help(Rsd subcommand help(Rfse subcommand help( RRRR4Rbtsubcommand_dataR*RsRR*R'(((s./usr/local/lib/python2.7/test/test_argparse.pyRgs   +tTestInvalidArgumentConstructorscBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s-Test a bunch of invalid Argument constructorscOs)tj}|jt|j||dS(N(R"R^RR|Rd(R R5R6Re((s./usr/local/lib/python2.7/test/test_argparse.pytassertTypeErrors cOs)tj}|jt|j||dS(N(R"R^RRRd(R R5R6Re((s./usr/local/lib/python2.7/test/test_argparse.pytassertValueErrors cCsP|jddd|jddd|jddd|jddidS( Ns-xRs-ytcallbackRit callback_argstcallback_kwargs((RjRF(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_invalid_keyword_argumentsscCs5|jx$ddgD]}|jd|qWdS(NRRR(Rj(R R((s./usr/local/lib/python2.7/test/test_argparse.pyttest_missing_destinations cCs|jd|jddS(Ns--s---(Rk(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_invalid_option_stringss cCs0|jddd|jddttfdS(Ns--fooR=R(RkRR (R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_invalid_type scCs|jddd|jddd|jddd tj}y|jdddWnStk rtjd }d }d ||f}|j|t|k|nXdS( Ns-xRRiRs--fooRRs store-trueisunknown actionsexpected %r, found %r(sstoresappend( RkR"R^RdRRPRTt assertTrueR(R ReRfRtmsg((s./usr/local/lib/python2.7/test/test_argparse.pyttest_invalid_actions  cCstj}|jddy|jdddWnStk rtjd}d}d||f}|j|t|k|nXdS(NRRiRRis+dest supplied twice for positional argumentsexpected %r, found %r(R"R^RdRRPRTRsR(R ReRfRRt((s./usr/local/lib/python2.7/test/test_argparse.pyttest_multiple_dests  cCsoxhdddddgD]Q}xHtdttddtd d gD]}|jd d ||qGWqWdS( NRRRRRR=RRRtabs-xR(RyRRj(R Rtattrs((s./usr/local/lib/python2.7/test/test_argparse.pyttest_no_argument_actions(s  cCsPxIdddgD]8}|jdddd||jddd d|qWdS( NRRRs-xRRiRRR(Rj(R R((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_no_argument_no_const_actions/sc CsxddgD]}|jdddd||jdddd|xUdd d gD]D}|jdd d d|d||jdd d d|d|qUWq WdS( NRRs-xRiRRiRRRRi(Rk(R RR((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_more_than_one_argument_actions9s cCs4x-ddgD]}|jdddd|q WdS(NRRs-xRRR(Rj(R R((s./usr/local/lib/python2.7/test/test_argparse.pyttest_required_const_actionsGscCsL|jddd|jddddd|jddddtjdS(NtcommandRtparsersRpRqRc(RjR"R^(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt"test_parsers_action_missing_paramsMscCs|jddtdS(NRiR(RjR&(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_required_positionalSsc sdtfdYdtffdY}tj}|j|jdd|dd|j|jd d|dddS( NtSuccesscBseZRS((RR(((s./usr/local/lib/python2.7/test/test_argparse.pyRXsRics#eZefdZdZRS(cs:|dkr6|kr6|kr3q3q6ndS(NR((R toption_stringsRRRR(R(s./usr/local/lib/python2.7/test/test_argparse.pyR7]s   c_sdS(N((R R5R6((s./usr/local/lib/python2.7/test/test_argparse.pyRghs(RRRR7Rg((R(s./usr/local/lib/python2.7/test/test_argparse.pyRi[ss--spamRRRR(RIRR"R^RRd(R RiRe((Rs./usr/local/lib/python2.7/test/test_argparse.pyttest_user_defined_actionVs (RRRRjRkRoRpRqRrRuRvRyRzR{R|RRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRis            tTestActionsReturnedcBseZdZdZRS(cCs|tj}|jd}|j|jd|jdd}|j|jd|jdd}|j|jddS( Ns--fooRis-bs--barRs-xs-yR(R"R^RdR R(R ReR((s./usr/local/lib/python2.7/test/test_argparse.pyRws cCstj}|jddddddddtd d d gd d dddd}|j|jd|j|jd|j|jd|j|jt|j|j d d g|j|j d |j|j d|j|j ddS(Ns--fooRRRi*RiTR=RiiRsRR5tBARRR( R"R^RdRR RRRR=RRsR5R(R ReR((s./usr/local/lib/python2.7/test/test_argparse.pyt test_miscs (RRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRus tTestConflictHandlingcBs#eZdZdZdZRS(cCs|jttjdddS(Ntconflict_handlerRi(RRR"R^(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt test_bad_typescCs\tj}|jd|jtj|jd|jd|jtj|jddS(Ns-xs--spam(R"R^RdRR(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_conflict_errors      cCstj}|dddd}|jddd|jddd|j|jtjd |jd d d |jd d d |j|jtjddS(NRpRqRtresolves-xRssOLD XsNEW Xs usage: PROG [-h] [-x X] optional arguments: -h, --help show this help message and exit -x X NEW X s--spamR5tOLD_SPAMtNEW_SPAMs usage: PROG [-h] [-x X] [--spam NEW_SPAM] optional arguments: -h, --help show this help message and exit -x X NEW X --spam NEW_SPAM (R"R^RdR RRR(R RRe((s./usr/local/lib/python2.7/test/test_argparse.pyttest_resolve_errors  (RRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs  tTestOptionalsHelpVersionActionscBsqeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z RS( s!Test the help and version actionscOsJy|||Wntk r/tjdSX|jt|||dS(Ni(RHRPRTR(R tfuncR5R6((s./usr/local/lib/python2.7/test/test_argparse.pyt _get_errors  cCs2|j|j|j|j|jjdS(N(R RRRWRRK(R ReR((s./usr/local/lib/python2.7/test/test_argparse.pytassertPrintHelpExits cCs2|j|j|j|j|jjdS(N(R tformat_versionRRWRRL(R ReR((s./usr/local/lib/python2.7/test/test_argparse.pytassertPrintVersionExits cGs|jt|j|dS(N(RRHRW(R ReR5((s./usr/local/lib/python2.7/test/test_argparse.pyRoscCsStdd}|j|d|j|d|j|d|j|ddS(NR's1.0s-hs--helps-vs --version(R]RR(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyt test_versions cCsDtdddd}|j|jdgj}|jd|dS(NRptPPPR's %(prog)s 3.5s-vsPPP 3.5 (R]RRWRLR (R ReRt((s./usr/local/lib/python2.7/test/test_argparse.pyttest_version_formatscCsYtdtdd}|j|d|j|d|j|d|j|ddS(NRR's1.0s-hs--helps-vs --version(R]RRoR(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_version_no_helps cCsWtdd}|jddddd|j|jdgj}|jd|dS(NRpRGs-VRR's %(prog)s 3.7sXXX 3.7 (R]RdRRWRLR (R ReRt((s./usr/local/lib/python2.7/test/test_argparse.pyttest_version_actionscCsStdt}|j|d|j|d|j|d|j|ddS(NRs-hs--helps-vs --version(R]RRo(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyt test_no_helps cCsst}|jddd|jddd|j|d|j|d|j|d|j|ddS(Ns-xRRss-yR's-vs --version(R]RdRRRo(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_alternate_help_versions cCstdd}|jddd|jddddd d g}|d d g}x|D]w}x|D]}d ||f}qhW|j||d|j||d|j||d|j||dq[WdS(NR's1.0s-xRRRRRis-x barsbaz -xs --bad-options foo bar bazs %s %%s %ss-hs--helps-vs --version(R]RdRR(R Retvalid_prefixestvalid_suffixestprefixtsuffixR((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_help_version_extra_argumentss   (RRRRRRRoRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs          t TestStringscBs;eZdZdZdZdZdZdZRS(s3Test str() and repr() on Optionals and PositionalscCs1x*ttgD]}|j|||q WdS(N(RRR (R tobjt result_stringR((s./usr/local/lib/python2.7/test/test_argparse.pytassertStringEqualscCshtjddddgddddd d d d d dddgdddd}d}|j||dS(NRs--foos-as-bRRR=RRRRi*RiiiRstHELPR5tMETAVARsAction(option_strings=['--foo', '-a', '-b'], dest='b', nargs='+', const=None, default=42, type='int', choices=[1, 2, 3], help='HELP', metavar='METAVAR')(R"RiR(R toptionR[((s./usr/local/lib/python2.7/test/test_argparse.pyt test_optionals  cCsctjdgdddtddddd d d dgd d dd}dt}|j||dS(NRRRR=RRRg@Rg?g?RssH HH HR5sMV MV MVsAction(option_strings=[], dest='x', nargs='?', const=None, default=2.5, type=%r, choices=[0.5, 1.5, 2.5], help='H HH H', metavar='MV MV MV')(R"RiR R(R targumentR[((s./usr/local/lib/python2.7/test/test_argparse.pyt test_argument-s  cCs2tjdddd}d}|j||dS(NRii*RRsNamespace(bar='spam', foo=42)(R"R R(R R R[((s./usr/local/lib/python2.7/test/test_argparse.pyttest_namespace=scCs3tjdd}dtj}|j||dS(NRpRqsArgumentParser(prog='PROG', usage=None, description=None, version=None, formatter_class=%r, conflict_handler='error', add_help=True)(R"R^t HelpFormatterR(R ReR[((s./usr/local/lib/python2.7/test/test_argparse.pyt test_parserBs (RRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs     t TestNamespacecBs#eZdZdZdZRS(cCsdtj}|jtt|dtjdddd}|j|jd|j|jddS(NRRi*RR(R"R RtAttributeErrorRRR RR(R R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_constructorPs  cCstjdddd}tjdddd}tjdd}tjdd}|j|||j|||j|||j|||j|||j||k|j||k|j||k|j||kdS(NRiRi(R"R R tassertNotEqualRs(R tns1tns2tns3tns4((s./usr/local/lib/python2.7/test/test_argparse.pyt test_equalityXscCsNtjdddd}|j|jdt|j|jdtdS(NRiRi(R"R tassertIsRDRFtNotImplementedRE(R R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_equality_returns_notimplemetedhs(RRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRNs  t TestEncodingcBs#eZdZdZdZRS(cCsNtjj|\}}|d7}tj|dd}|jWdQXdS(Ns.pyR8tutf8(RR tsplitexttcodecsR-R@(R R RuR((s./usr/local/lib/python2.7/test/test_argparse.pyt_test_module_encodingus cCs|jtjdS(N(RR"t__file__(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_argparse_module_encoding{scCs|jtdS(N(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt"test_test_argparse_module_encoding~s(RRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRss  tTestArgumentErrorcBseZdZRS(cCs2d}tjd|}|jt||dS(Ns my error here(R"RRFR R(R RtR_((s./usr/local/lib/python2.7/test/test_argparse.pyttest_argument_errors(RRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestArgumentTypeErrorcBseZdZRS(cCsd}tdddt}|jdd|y|jdgWn:tk rd}tjd j}|j||n X|j dS( NcSstjddS(Nsspam!(R"tArgumentTypeError(R[((s./usr/local/lib/python2.7/test/test_argparse.pyRsRpRqRRR=RGs-usage: PROG x PROG: error: argument x: spam! i( R]RRdRWRHRPRTRLR tfail(R RReRRt((s./usr/local/lib/python2.7/test/test_argparse.pyttest_argument_type_errors  (RRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestTypeFunctionCallOnlyOncecBseZdZRS(csffd}tj}|jdd|dd|jdj}jtdd|dS( Ncsj|ddS(Nsspam!t foo_converted(R (tstring_to_convert(R (s./usr/local/lib/python2.7/test/test_argparse.pyRss--fooR=RRs --foo spam!RiR(R"R^RdRWRR R8(R RReR5((R s./usr/local/lib/python2.7/test/test_argparse.pyt!test_type_function_call_only_onces  (RRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRstTestTypeFunctionCalledOnDefaultcBs,eZdZdZdZdZRS(cs`fd}tj}|jdd|dd|jg}jtdd|dS(Ncsj|ddS(NiR(R (tint_to_convert(R (s./usr/local/lib/python2.7/test/test_argparse.pyRss--fooR=RiRi(R"R^RdRWR R8(R RReR5((R s./usr/local/lib/python2.7/test/test_argparse.pyt/test_type_function_call_with_non_string_defaults  cCsZd}tj}|jdd|dd|jg}|jtdd|dS(NcSsdS(NR((R((s./usr/local/lib/python2.7/test/test_argparse.pyRss--fooR=Rt0RiR(R"R^RdRWR R8(R RReR5((s./usr/local/lib/python2.7/test/test_argparse.pyt+test_type_function_call_with_string_defaults   cCsZd}tj}|jdd|dd|jg}|jtdd|dS(NcSs|dS(NR((tstr_to_convert((s./usr/local/lib/python2.7/test/test_argparse.pytextendss--testR=RRR`s**(R"R^RdRWR R8(R RReR5((s./usr/local/lib/python2.7/test/test_argparse.pyt)test_no_double_type_conversion_of_defaults   c CsWtj}|jddddtdgdd|jg}|j|jgdS(Ns--testRR`R=RRR(R"R^RdRRWR R`(R ReR5((s./usr/local/lib/python2.7/test/test_argparse.pyttest_issue_15906s   (RRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs tTestParseKnownArgscBs>eZdZdZdZdZdZdZRS(cCstj}|jddS(N((R"R^RW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_arguments_tuples cCstj}|jgdS(N(R"R^RW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_arguments_lists cCs*tj}|jd|jddS(NR(R(R"R^RdRW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_arguments_tuple_positionals  cCs-tj}|jd|jdgdS(NR(R"R^RdRW(R Re((s./usr/local/lib/python2.7/test/test_argparse.pyttest_arguments_list_positionals  cCsgtj}|jd|jdj\}}|jtdd||jddg|dS(Ns--foos--foo F --bar --bazRitFs--bars--baz(R"R^RdRRR R8(R ReR5textras((s./usr/local/lib/python2.7/test/test_argparse.pyttest_optionalss   cCstj}|jddddddt|jddd |jd d d d dddg}|j|\}}|jtdddtd d ||jd d dg|dS(Ns-vRRRiR=s--spamRRRRRYs--fooRuRtviR(R"R^RdRRR R8R&(R ReRqR5R((s./usr/local/lib/python2.7/test/test_argparse.pyt test_mixeds  %(RRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs      tTestAddArgumentMetavarcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1RS(0s,length of metavar tuple does not match nargscCs)tj}|jdd|d|dS(Ns--fooRR5(R"R^Rd(R RR5Re((s./usr/local/lib/python2.7/test/test_argparse.pytdo_test_no_exceptions c Cs^tj}|jt }|jdd|d|WdQX|j|jjd|jdS(Ns--fooRR5i( R"R^RRRdR t exceptionR5tEXPECTED_MESSAGE(R RR5Retcm((s./usr/local/lib/python2.7/test/test_argparse.pytdo_test_exceptions cCs|jdddddS(NRR5R(RRF(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_None_metavar_string!scCs|jdddtdS(NRR5(RRFttuple(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_None_metavar_length0$scCs|jdddddS(NRR5R(RRF(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_None_metavar_length1'scCs|jdddddS(NRR5RR(RR(RRF(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_None_metavar_length2*scCs|jdddddS(NRR5RRRu(RRRu(RRF(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_None_metavar_length3-scCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt"test_nargs_optional_metavar_string2scCs|jdddtdS(NRRR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_optional_metavar_length05scCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_optional_metavar_length18scCs|jdddddS(NRRR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_optional_metavar_length2;scCs|jdddddS(NRRR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_optional_metavar_length3>scCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_zeroormore_metavar_stringCscCs|jdddtdS(NRRR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt%test_nargs_zeroormore_metavar_length0FscCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt%test_nargs_zeroormore_metavar_length1IscCs|jdddddS(NRRR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt%test_nargs_zeroormore_metavar_length2LscCs|jdddddS(NRRR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt%test_nargs_zeroormore_metavar_length3OscCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_oneormore_metavar_stringTscCs|jdddtdS(NRRR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_oneormore_metavar_length0WscCs|jdddddS(NRRR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_oneormore_metavar_length1ZscCs|jdddddS(NRRR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_oneormore_metavar_length2]scCs|jdddddS(NRRR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_oneormore_metavar_length3`scCs|jdddddS(NRs...R5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt#test_nargs_remainder_metavar_stringescCs|jdddtdS(NRs...R5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_remainder_metavar_length0hscCs|jdddddS(NRs...R5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_remainder_metavar_length1kscCs|jdddddS(NRs...R5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_remainder_metavar_length2nscCs|jdddddS(NRs...R5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt$test_nargs_remainder_metavar_length3qscCs|jdddddS(NRsA...R5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt test_nargs_parser_metavar_stringvscCs|jdddtdS(NRsA...R5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_nargs_parser_metavar_length0yscCs|jdddddS(NRsA...R5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_nargs_parser_metavar_length1|scCs|jdddddS(NRsA...R5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_nargs_parser_metavar_length2scCs|jdddddS(NRsA...R5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyt!test_nargs_parser_metavar_length3scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_1_metavar_stringscCs|jdddtdS(NRiR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_1_metavar_length0scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_1_metavar_length1scCs|jdddddS(NRiR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_1_metavar_length2scCs|jdddddS(NRiR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_1_metavar_length3scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_2_metavar_stringscCs|jdddtdS(NRiR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_2_metavar_length0scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_2_metavar_length1scCs|jdddddS(NRiR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_2_metavar_length2scCs|jdddddS(NRiR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_2_metavar_length3scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_3_metavar_stringscCs|jdddtdS(NRiR5(RR(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_3_metavar_length0scCs|jdddddS(NRiR5R(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_3_metavar_length1scCs|jdddddS(NRiR5RR(RR(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_3_metavar_length2scCs|jdddddS(NRiR5RRRu(RRRu(R(R ((s./usr/local/lib/python2.7/test/test_argparse.pyttest_nargs_3_metavar_length3s(2RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR R R R R RRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyRs`                                              tTestImportStarcBseZdZdZRS(cCs.x'tjD]}|jtt|q WdS(N(R"t__all__RsR(R R*((s./usr/local/lib/python2.7/test/test_argparse.pyR`scCslgttjD]0\}}|jdstj|s|^q}|jt|ttjdS(NRu( RBR"R<t startswithtinspecttismoduleR R;R(R R*RWR<((s./usr/local/lib/python2.7/test/test_argparse.pyt'test_all_exports_everything_but_moduless (RRR`R(((s./usr/local/lib/python2.7/test/test_argparse.pyRs cCsKtjdtfdtftjtWdQXit_tt_dS(Ns7The "version" argument to ArgumentParser is deprecated.s/The (format|print)_version method is deprecated( Rtcheck_warningstDeprecationWarningt run_unittestRR=R?RRJ(((s./usr/local/lib/python2.7/test/test_argparse.pyt test_mains  t__main__(RRRR$R"RPRRtunittestR"RRR`RRRRR4R8RIRHR\R^R]R=R`RRaRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR R R R R RRRRRRRRRR!R$R&R(R1R7R=RBRFRHRJtskipIfRRNRORPRQRURXRZRaRjRnRRRRRRRRRRRRRRRRRRRRRRRR RRR+R/R0R1R4R6R8R9R:R=R?R@RARBRCRDRERFRIRJRKRLRMRNRORPRQRRRSRTR]R`RbReRfRgRiRRRRRRRRRRRRRRR(((s./usr/local/lib/python2.7/test/test_argparse.pyts           q                                          ## $ C'&0#+!$-*(- WZ #7.4(6,$&"$. 10(.-V8% 1*