ó
‹wÛjc           @   sÎ   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z m Z m Z m Z d d  d! d" d# d$ d% d& d' d( d) f Z	 d e j
 f d „  ƒ  YZ d e j f d „  ƒ  YZ d „  Z e d k rÊ e ƒ  n  d S(*   iÿÿÿÿN(   t   findfilet   TESTFNt   unlinkt   run_unittests
   python.pngt   pngs
   python.gift   gifs
   python.bmpt   bmps
   python.ppmt   ppms
   python.pgmt   pgms
   python.pbmt   pbms
   python.jpgt   jpegs
   python.rast   rasts
   python.sgit   rgbs   python.tifft   tiffs
   python.xbmt   xbmt   UnseekableIOc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   t  j ‚ d  S(   N(   t   iot   UnsupportedOperation(   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_imghdr.pyt   tell   s    c         O   s   t  j ‚ d  S(   N(   R   R   (   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_imghdr.pyt   seek   s    (   t   __name__t
   __module__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_imghdr.pyR      s   	t
   TestImghdrc           B   sq   e  Z e 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   sC   t  d d d ƒ|  _ t |  j d ƒ � } | j ƒ  |  _ Wd  QXd  S(   Ns
   python.pngt   subdirt
   imghdrdatat   rb(   R    t   testfilet   opent   readt   testdata(   t   clst   stream(    (    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_imghdr.pyt
   setUpClass   s    c         C   s   t  t ƒ d  S(   N(   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_imghdr.pyt   tearDown#   s    c         C   så   xÞ t  D]Ö \ } } t | d d ƒ} |  j t j | ƒ | ƒ | j t j ƒ  ƒ } |  j t j | ƒ | ƒ t | d ƒ �  } |  j t j | ƒ | ƒ Wd  QXt | d ƒ � } | j	 ƒ  } Wd  QX|  j t j d  | ƒ | ƒ q Wd  S(   NR   R   R   (   t
   TEST_FILESR    t   assertEqualt   imghdrt   whatt   decodet   syst   getfilesystemencodingR   R   t   None(   R   t   filenamet   expectedt	   ufilenameR"   t   data(    (    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_imghdr.pyt	   test_data&   s    c         C   sL   d „  } t  j j | ƒ |  j t  j j ƒ |  j t  j d  d ƒ d ƒ d  S(   Nc         S   s   |  j  d ƒ r d Sd  S(   Nt   eggst   ham(   t
   startswith(   t   ht   file(    (    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_imghdr.pyt
   test_jumbo3   s    R2   R3   (   R'   t   testst   appendt
   addCleanupt   popR&   R(   R,   (   R   R7   (    (    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_imghdr.pyt   test_register_test2   s    	c         C   s™   t  t d ƒ �0 } | j d ƒ | j ƒ  } | j |  j ƒ Wd  QXt  t d ƒ �C } | j | ƒ |  j t j | ƒ d ƒ |  j | j ƒ  | ƒ Wd  QXd  S(   Nt   wbt   ababagalamagaR   R   (	   R   R   t   writeR   R    R   R&   R'   R(   (   R   R"   t   pos(    (    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_imghdr.pyt   test_file_pos:   s    c         C   s´   |  j  t ƒ � t j ƒ  Wd  QX|  j  t ƒ � t j d  ƒ Wd  QX|  j  t ƒ � t j |  j d ƒ Wd  QXt |  j d ƒ �0 } |  j  t ƒ � t j | j ƒ  ƒ Wd  QXWd  QXd  S(   Ni   R   (	   t   assertRaisest	   TypeErrorR'   R(   t   AttributeErrorR,   R   R   t   fileno(   R   t   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_imghdr.pyt   test_bad_argsD   s    c         C   s.   x' d D] } |  j  t j d  | ƒ ƒ q Wd  S(   Ns   ‰PN
s   Ùs   Y¦t   cutecatt	   000000JFIt   GIF80(   s   ‰PN
s   Ùs   Y¦RH   RI   RJ   (   t   assertIsNoneR'   R(   R,   (   R   t   header(    (    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_imghdr.pyt   test_invalid_headersO   s        
c         C   s'   |  j  t ƒ � t j d ƒ Wd  QXd  S(   Nt   missing(   RB   t   IOErrorR'   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_imghdr.pyt   test_missing_fileX   s    c         C   s†   t  |  j d ƒ } | j ƒ  |  j t ƒ � } t j | ƒ Wd  QXt j |  j	 ƒ } | j ƒ  |  j t ƒ � } t j | ƒ Wd  QXd  S(   NR   (
   R   R   t   closeRB   t
   ValueErrorR'   R(   R   t   BytesIOR    (   R   R"   t   cm(    (    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_imghdr.pyt   test_closed_file\   s    

c         C   sj   t  t d ƒ � } | j |  j ƒ Wd  QXt t d ƒ �- } |  j t j ƒ � t j	 | ƒ Wd  QXWd  QXd  S(   NR=   R   (
   R   R   R?   R    R   RB   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_imghdr.pyt   test_unseekablef   s
    c      
   C   s^   t  t d ƒ �I } | j |  j ƒ | j d ƒ |  j t ƒ � } t j | ƒ Wd  QXWd  QXd  S(   NR=   i    (	   R   R   R?   R    R   RB   RO   R'   R(   (   R   R"   RT   (    (    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_imghdr.pyt   test_output_streamm   s
    (   R   R   t   classmethodR#   R$   R1   R<   RA   RG   RM   RP   RU   RV   RW   (    (    (    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_imghdr.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_imghdr.pyt	   test_maint   s    t   __main__(   s
   python.pngR   (   s
   python.gifR   (   s
   python.bmpR   (   s
   python.ppmR   (   s
   python.pgmR   (   s
   python.pbmR	   (   s
   python.jpgR
   (   s
   python.rasR   (   s
   python.sgiR   (   s   python.tiffR   (   s
   python.xbmR   (   R'   R   R*   t   unittestt   test.test_supportR    R   R   R   R%   t   FileIOR   t   TestCaseR   RY   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_imghdr.pyt   <module>   s(   "	X	