ó
ŠwÛjc           @   s›   d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d „  Z	 d e j
 f d „  ƒ  YZ d „  Z e d	 k r— e ƒ  n  d S(
   s'   Unit tests for collections.defaultdict.iÿÿÿÿN(   t   test_support(   t   defaultdictc           C   s   t  S(   N(   t   list(    (    (    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_defaultdict.pyt   foobar   s    t   TestDefaultDictc           B   sb   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z RS(
   c         C   sz  t  ƒ  } |  j | j d  ƒ t | _ | d j d ƒ |  j | i d g d 6ƒ | d j d ƒ |  j | i d d g d 6ƒ | d | d |  j | i d d g d 6g  d 6g  d 6ƒ |  j | d | d k	 oâ | d k	 n ƒ t  t d d d d	 ƒ} |  j | j t ƒ |  j | i d d 6d	 d 6ƒ |  j | d d ƒ |  j | d d	 ƒ |  j | d g  ƒ |  j d | ƒ |  j d | j ƒ  ƒ |  j d | ƒ |  j d | j ƒ  ƒ |  j d | ƒ |  j d | j ƒ  ƒ |  j	 d | ƒ |  j	 d | j ƒ  ƒ d  | _ |  j | j d  ƒ y | d
 Wn& t
 k
 rU} |  j | j d ƒ n X|  j d ƒ |  j t t  d ƒ d  S(   Ni   i*   i   i   i   t   fooi   t   bari   i   s   d2[15] didn't raise KeyError(   i   (   R   t   assertEqualt   default_factoryt   NoneR   t   appendt
   assertTruet   assertInt   keyst   assertNotInt   KeyErrort   argst   failt   assertRaisest	   TypeError(   t   selft   d1t   d2t   err(    (    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_defaultdict.pyt
   test_basic   sB    		+/	c         C   sE   t  ƒ  } |  j t | j d ƒ t | _ |  j | j d ƒ g  ƒ d  S(   Ni*   (   R   R   R   t   __missing__R   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_defaultdict.pyt   test_missing4   s    		c         C   s  t  ƒ  } |  j | j d  ƒ |  j t | ƒ d ƒ |  j t t | ƒ ƒ | ƒ d | d <|  j t | ƒ d ƒ t  t ƒ } |  j | j t ƒ d | d <|  j t | ƒ d ƒ d „  } t  | ƒ } |  j | j | k ƒ | d	 |  j t | ƒ d
 t | ƒ ƒ d  S(   Ns   defaultdict(None, {})i)   i   s   defaultdict(None, {11: 41})i*   i   s#   defaultdict(<type 'int'>, {12: 42})c           S   s   d S(   Ni+   (    (    (    (    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_defaultdict.pyR   E   t    i   s   defaultdict(%s, {13: 43})(   R   R   R   R	   t   reprt   evalt   intR   (   R   R   R   R   t   d3(    (    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_defaultdict.pyt	   test_repr:   s    	

	c         C   sÏ   t  ƒ  } d „  } t  | i d d 6ƒ } t j ƒ  } z† t | d ƒ } ze | | IJ| | IJ| j d ƒ |  j | j ƒ  t | ƒ d ƒ |  j | j ƒ  t | ƒ d ƒ Wd  | j ƒ  XWd  t	 j
 | ƒ Xd  S(   Nc           S   s   d S(   Ni*   (    (    (    (    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_defaultdict.pyR   M   R   i   i   s   w+i    s   
(   R   t   tempfilet   mktempt   opent   seekR   t   readlineR   t   closet   ost   remove(   R   R   R   R   t   tfnt   f(    (    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_defaultdict.pyt
   test_printK   s    		

 $c         C   sM  t  ƒ  } | j ƒ  } |  j t | ƒ t  ƒ |  j | j d  ƒ |  j | i  ƒ t | _ | j ƒ  } |  j t | ƒ t  ƒ |  j | j t ƒ |  j | i  ƒ | d | j ƒ  } |  j t | ƒ t  ƒ |  j | j t ƒ |  j | i g  d 6ƒ | d |  j | i g  d 6g  d 6ƒ t  ƒ  } d | d <| j ƒ  } |  j | d d ƒ d  S(   Ni*   i   t   a(   R   t   copyR   t   typeR   R	   R   (   R   R   R   R   t   d4t   dt   e(    (    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_defaultdict.pyt	   test_copy`   s*    			
c         C   s‡   t  t i d d 6ƒ } t j | ƒ } |  j | j t ƒ |  j | | ƒ t | _ t j | ƒ } |  j | j t ƒ |  j | | ƒ d  S(   Ni   (   R   R   R-   R   R   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_defaultdict.pyt   test_shallow_copyy   s    	c         C   s¥   t  t i d g d 6ƒ } t j | ƒ } |  j | j t ƒ |  j | | ƒ |  j | d | d k	 ƒ t | _ t j | ƒ } |  j | j t ƒ |  j | | ƒ d  S(   Ni   (   R   R   R-   t   deepcopyR   R   R   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_defaultdict.pyt   test_deep_copyƒ   s    	c         C   sS   t  ƒ  } y | d Wn* t k
 rA } |  j | j d d ƒ n X|  j d ƒ d  S(   Ni   i    s   expected KeyError(   i   (   i   (   R   R   R   R   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_defaultdict.pyt   test_keyerror_without_factoryŽ   s    	c         C   s‹   d t  f d „  ƒ  Y} | ƒ  } |  j t | ƒ j d ƒ ƒ t j ƒ  } z/ t | d ƒ } z | | IJWd  | j ƒ  XWd  t j	 | ƒ Xd  S(   Nt   subc           B   s   e  Z d  „  Z d „  Z RS(   c         S   s   |  j  |  _ d  S(   N(   t   _factoryR   (   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_defaultdict.pyt   __init__š   s    c         S   s   g  S(   N(    (   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_defaultdict.pyR8   œ   s    (   t   __name__t
   __module__R9   R8   (    (    (    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_defaultdict.pyR7   ™   s   	s9   defaultdict(<bound method sub._factory of defaultdict(...s   w+(
   R   R   R   t
   startswithR!   R"   R#   R&   R'   R(   (   R   R7   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_defaultdict.pyt   test_recursive_repr—   s    	
c         C   s   |  j  t t i  ƒ d  S(   N(   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_defaultdict.pyt   test_callable_arg®   s    (   R:   R;   R   R   R    R+   R2   R3   R5   R6   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_defaultdict.pyR      s   	$					
				c           C   s   t  j t ƒ d  S(   N(   R    t   run_unittestR   (    (    (    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_defaultdict.pyt	   test_main±   s    t   __main__(   t   __doc__R'   R-   R!   t   unittestt   testR    t   collectionsR   R   t   TestCaseR   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_defaultdict.pyt   <module>   s   	£	