ó
‹wÛjc        	   @   s  d  Z  d d l m Z m Z m Z m Z e d d e ƒZ d d l Z d d l	 Z	 d d l
 Z
 d Z d d d d d d d  d" f Z e d „  e e ƒ Dƒ ƒ d# e Z d d Z d$ Z d e
 j f d „  ƒ  YZ d „  Z d „  Z d „  Z e d k r e ƒ  n  d S(%   s„   Test script for the imageop module.  This has the side
   effect of partially testing the imgfile module as well.
   Roger E. Masse
iÿÿÿÿ(   t   verboset   unlinkt   import_modulet   run_unittestt   imageopt
   deprecatedNi   i   i   i   i
   i   i   c         c   s   |  ] } | Vq d  S(   N(    (   t   .0t   x(    (    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_imageop.pys	   <genexpr>   s    i    t   Ai   i   t   InputValidationTestsc           B   s/   e  Z d d  „ Z d „  Z d „  Z d „  Z RS(   c   
      G   sÔ   t  t | ƒ } x¾ t D]¶ } x­ t D]¥ } t | | ƒ } | rL | | 9} n  | t k  re d | } n t } | rŠ | | | | f | }	 n | | | f | }	 y | |	 Œ  Wq# t t j f k
 rÇ q# Xq# Wq Wd  S(   NR   (   t   getattrR   t   VALUESt   abst   MAX_LENt   AAAAAt
   ValueErrort   error(
   t   selft   namet   sizet   extrat   funct   heightt   widtht   strlent   datat	   arguments(    (    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_imageop.pyt   _check   s     c         G   s(   x! t  D] } |  j | | | Œ q Wd  S(   N(   t   SIZESR   (   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_imageop.pyt
   check_size)   s    c         G   s   |  j  | d  | Œ d  S(   N(   R   t   None(   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_imageop.pyt   check-   s    c         C   s  |  j  d d d d d ƒ |  j  d d d ƒ |  j  d d d ƒ |  j  d ƒ |  j d d ƒ |  j d	 ƒ |  j d
 ƒ |  j d ƒ |  j d ƒ |  j d d d ƒ |  j d ƒ |  j d ƒ |  j d ƒ |  j d ƒ |  j d ƒ |  j t j ƒ � t j d d d d ƒ Wd  QXd  S(   Nt   cropi    t   scalei   iÿÿÿÿt   tovideot	   grey2monoi€   t
   grey2grey4t
   grey2grey2t   dither2monot   dither2grey2t	   mono2greyt
   grey22greyt   rgb2rgb8t   rgb82rgbt   rgb2greyt   grey2rgbR   i   i�   (   R   R   t   assertRaisesR   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_imageop.pyt   test_input_validation0   s"    N(   t   __name__t
   __module__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_imageop.pyR	      s   		c       	   C   sÅ  t  t ƒ y d d  l }  Wn t k
 r. d  SXt j t d t j d ƒ d t j d ƒ t	 d t j d ƒ \ } } } t
 r‰ d GHn  t j | d | | d d d	 d	 ƒ } t
 r» d
 GHn  t j | d | | d	 d	 ƒ } t
 rç d GHn  t j | d | | ƒ } t
 rd GHn  t j | | | ƒ } t
 r0d GHn  t j | | | ƒ } t
 rSd GHn  t j | | | ƒ } t
 rvd GHn  t j | | | ƒ } t
 r™d GHn  t j | | | d ƒ } t
 r¿d GHn  t j | | | d d ƒ } t
 rèd GHn  t j | | | ƒ } t
 rd GHn  t j | | | ƒ }	 t
 r.d GHn  t j | | | ƒ }
 t
 rQd GHn  t j | | | ƒ }
 t
 rtd GHn  t j |	 | | ƒ } t
 r—d GHn  t j |
 | | ƒ } t d t j d ƒ d  S(   Niÿÿÿÿt   testrgbt   uuet   testt   rgbR    i   i    i   R!   R"   R*   R+   R,   R-   R#   R(   iÿ   R&   R$   R%   R'   t
   grey42greyR)   (   R   R	   t   imgfilet   ImportErrort   uut   decodet   get_qualified_patht   ost   extsept   getimageR    R   R    R!   R"   R*   R+   R,   R-   R#   R(   R&   R$   R%   R'   R6   R)   R   (   R7   t   imageR   R   t   newimaget
   scaleimaget
   videoimaget	   greyimaget	   monoimaget
   grey4imaget
   grey2image(    (    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_imageop.pyt	   test_mainD   sj    
, $c         C   s“   d d l  } y | j |  ƒ } Wn/ | j k
 rP t |  ƒ }  | j |  ƒ } n Xt ro d |  t | ƒ f GHn  | j |  ƒ } | | d | d f S(   sU   return a tuple consisting of
       image (in 'imgfile' format) width and height
    iÿÿÿÿNs)   imgfile opening test image: %s, sizes: %si    i   (   R7   t   getsizesR   R;   R    t   strt   read(   R   R7   t   sizesR?   (    (    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_imageop.pyR>   ³   s    c         C   s’   d d l  } d d l } | j } y | j j t ƒ g | } Wn t k
 rQ n Xx9 | D]1 } | j j | |  ƒ } | j j | ƒ rY | SqY W|  S(   s%    return a more qualified path to nameiÿÿÿÿN(   t   sysR<   t   patht   dirnamet   __file__t	   NameErrort   joint   exists(   R   RL   R<   RM   t   dirt   fullname(    (    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_imageop.pyR;   Ã   s    	t   __main__(   i   i   i   i   i   i €  iÿ  i €  i €  i€  I   €    iþÿÿI   €    iÿÿÿ(   i    i   (   t   __doc__t   test.test_supportR    R   R   R   t   TrueR   R9   R<   t   unittestR   t   _VALUESt   tuplet   reversedR   R   R   t   TestCaseR	   RG   R>   R;   R0   (    (    (    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_imageop.pyt   <module>   s   "$$
1	o		