asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYh@sPddlmZmZmZddlZddlZeZGdddejZ e dkrLe dS))verbose run_doctestEnvironmentVarGuardNc@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS) GetoptTestscCst|_d|jvr|jd=dS)NPOSIXLY_CORRECT)renvselfr ,/usr/local/lib/python3.9/test/test_getopt.pysetUp s zGetoptTests.setUpcCs|j|`dSN)r__exit__rr r r tearDowns zGetoptTests.tearDowncOs|jtjg|Ri|dSr ) assertRaisesgetopt GetoptError)r argskwargsr r r assertErrorszGetoptTests.assertErrorcCs8|tdd|tdd|tjdddS)Naa:b) assertTruerZ short_has_arg assertFalserrr r r test_short_has_argszGetoptTests.test_short_has_argcCstddg\}}||||dtddg\}}||||dtddg\}}||||d|tjddg|tjdg|tjdddgdS)Nabcabc=abcddefZabcde)rZ long_has_argsr assertEqualrr)r Zhas_argoptionr r r test_long_has_argss      zGetoptTests.test_long_has_argscCstgddg\}}||dg||gtgddg\}}||dg||gtgdddg\}}||dg||gtgddddg\}}||dg||dg|tjgddg|tjgddgdS)Nr-aZa1rr$1r'2)rZ do_shortsr rr optsrr r r test_do_shorts.s   zGetoptTests.test_do_shortscCs$tgddgg\}}||dg||gtgddgg\}}||dg||gtgddgg\}}||dg||gtgdgdg\}}||dg||gtgd d d gg\}}||d g||g|tjgddgg|tjgddggdS) Nr)--abcr%zabc=1r)r,r'zabcd=)z--abcdr')abrrzfoo=42zfoo-barzfoo=)z--fooZ42)rZdo_longsr rr)r r r test_do_longsFs"     zGetoptTests.test_do_longscCsXgd}t|dddg\}}||gd||ddg|tj|dddgdS) N) r$r'-bz --alpha=2--betar$3r$r%r0arg1arg2za:bzalpha=beta)r&)r/r%)--alphar(r0r%)r$r1r#r6r2r3alpha)rr rr Zcmdliner*rr r r test_getoptas zGetoptTests.test_getoptcCsgd}t|dddg\}}||dg||gdtgddg\}}||dg||d d gt|d ddg\}}||d g||gd d |jd<t|dddg\}}||d g||gd dS)N)r$r2r/r'r5--beta=2zab:r7zbeta=r2)r#)r/r')r5r%)r0r()r$-r/r;r;r#)r/r;z+ab:)r2r/r'r5r:r'r)rZ gnu_getoptr rr8r r r test_gnu_getoptrs zGetoptTests.test_gnu_getoptcCs&d}ddl}|d|}t|tdS)Na Examples from the Library Reference: Doc/lib/libgetopt.tex An example using only Unix style options: >>> import getopt >>> args = '-a -b -cfoo -d bar a1 a2'.split() >>> args ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] >>> optlist, args = getopt.getopt(args, 'abc:d:') >>> optlist [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] >>> args ['a1', 'a2'] Using long option names is equally easy: >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' >>> args = s.split() >>> args ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] >>> optlist, args = getopt.getopt(args, 'x', [ ... 'condition=', 'output-file=', 'testing']) >>> optlist [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] >>> args ['a1', 'a2'] rZ libreftest)types ModuleTyperr)r sr=mr r r test_libref_exampless z GetoptTests.test_libref_examplescCsftdgddg\}}||dgtdgddg\}}||dg|tjtjdgddgdS)Nz--help=r%zhelp=)--helpr%z--help=x)rBxhelp)rr rr)r ZlongoptsZ shortoptsr r r test_issue4629s zGetoptTests.test_issue4629N)__name__ __module__ __qualname__r rrrr"r+r.r9r<rArEr r r r r s$r__main__) Z test.supportrrrZunittestrobjectsentinelZTestCaserrFmainr r r r s-