ó
‹wÛjc           @   s   d  d l  m Z m Z m Z m Z d  d l Z d  d l Z e ƒ  Z d e j	 f d „  ƒ  YZ
 d „  Z e d k r{ e ƒ  n  d S(   iÿÿÿÿ(   t   verboset   run_doctestt   run_unittestt   EnvironmentVarGuardNt   GetoptTestsc           B   sk   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z RS(   c         C   s,   t  ƒ  |  _ d |  j k r( |  j d =n  d  S(   Nt   POSIXLY_CORRECT(   R   t   env(   t   self(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   setUp   s    c         C   s   |  j  j ƒ  |  `  d  S(   N(   R   t   __exit__(   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   tearDown   s    c         O   s   |  j  t j | | Ž d  S(   N(   t   assertRaisest   getoptt   GetoptError(   R   t   argst   kwargs(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   assertError   s    c         C   sL   |  j  t j d d ƒ ƒ |  j t j d d ƒ ƒ |  j t j d d ƒ d  S(   Nt   as   a:t   b(   t
   assertTrueR   t   short_has_argt   assertFalseR   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_short_has_arg   s    c         C   s÷   t  j d d g ƒ \ } } |  j | ƒ |  j | d ƒ t  j d d g ƒ \ } } |  j | ƒ |  j | d ƒ t  j d d g ƒ \ } } |  j | ƒ |  j | d ƒ |  j t  j d d g ƒ |  j t  j d g  ƒ |  j t  j d d d g ƒ d  S(   Nt   abcs   abc=t   abcdt   deft   abcde(   R   t   long_has_argsR   t   assertEqualR   R   (   R   t   has_argt   option(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_long_has_args   s    c         C   sL  t  j g  d d g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ t  j g  d d g  ƒ \ } } |  j | d	 g ƒ |  j | g  ƒ t  j g  d d d g ƒ \ } } |  j | d
 g ƒ |  j | g  ƒ t  j g  d d d d g ƒ \ } } |  j | d g ƒ |  j | d g ƒ |  j t  j g  d d g  ƒ |  j t  j g  d d g  ƒ d  S(   NR   s   -at    t   a1s   a:t   1t   2(   s   -aR    (   s   -aR"   (   s   -aR"   (   s   -aR"   (   R   t	   do_shortsR   R   (   R   t   optsR   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_do_shorts.   s    !$c         C   sŸ  t  j g  d d g g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ t  j g  d d g g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ t  j g  d d g g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ t  j g  d d	 d d
 g g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ t  j g  d d d g g  ƒ \ } } |  j | d g ƒ |  j | g  ƒ |  j t  j g  d d g g  ƒ |  j t  j g  d d g g  ƒ d  S(   NR   s   --abcR    s   abc=1s   abc=R"   s   abcd=s   --abcdt   abR   s   foo=42s   foo-bars   foo=s   --foot   42(   s   --abcR    (   s   --abcR"   (   s   --abcdR"   (   s   --abcR    (   s   --fooR(   (   R   t   do_longsR   R   (   R   R%   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_do_longsF   s"    !!!'$c         C   s©   d d d d d d d d d d d d	 g } t  j  | d
 d d g ƒ \ } } |  j | d d d d d d d g ƒ |  j | d d	 g ƒ |  j t  j  | d
 d d g ƒ d  S(   Ns   -aR"   s   -bs	   --alpha=2s   --betat   3R    t   arg1t   arg2s   a:bs   alpha=t   betas   --alphaR#   t   alpha(   s   -aR"   (   s   -bR    (   s   --alphaR#   (   s   --betaR    (   s   -aR+   (   s   -aR    (   s   --betaR    (   R   R   R   (   R   t   cmdlineR%   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_getopta   s    !c         C   so  d d d d d d g } t  j | d d d	 g ƒ \ } } |  j | d g ƒ |  j | d d d d g ƒ t  j d d d d g d g  ƒ \ } } |  j | d g ƒ |  j | d d g ƒ t  j | d d d	 g ƒ \ } } |  j | d g ƒ |  j | d d d d d g ƒ d |  j d <t  j | d d d	 g ƒ \ } } |  j | d g ƒ |  j | d d d d d g ƒ d  S(   Ns   -aR,   s   -bR"   s   --alphas   --beta=2s   ab:R/   s   beta=R    s   --betaR#   t   -s   +ab:R   (   s   -aR    (   s   -bR"   (   s   --alphaR    (   s   --betaR#   (   s   -aR    (   s   -bR2   (   s   -aR    (   s   -aR    (   R   t
   gnu_getoptR   R   (   R   R0   R%   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_gnu_getoptr   s    !'!!c         C   s5   d } d d  l  } | j d | ƒ } t | t ƒ d  S(   NsÚ  
        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']
        iÿÿÿÿt
   libreftest(   t   typest
   ModuleTypeR   R    (   R   t   sR6   t   m(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_libref_examplesŒ   s    c         C   s‘   t  j  d g d d g ƒ \ } } |  j | d g ƒ t  j  d g d d g ƒ \ } } |  j | d	 g ƒ |  j t  j t  j  d g d d g ƒ d  S(
   Ns   --help=R    s   help=s   --helps   --help=xt   xt   help(   s   --helpR    (   s   --helpR;   (   R   R   R   R   (   R   t   longoptst	   shortopts(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   test_issue4629°   s
    !!(   t   __name__t
   __module__R   R
   R   R   R   R&   R*   R1   R4   R:   R?   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyR      s   										$c           C   s   t  t ƒ d  S(   N(   R   R   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt	   test_main·   s    t   __main__(   t   test.test_supportR    R   R   R   t   unittestR   t   objectt   sentinelt   TestCaseR   RB   R@   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_getopt.pyt   <module>   s   "	¬	