ó
‹wÛjc           @   sØ  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l 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 y d  d l Z Wn e k
 rµ e Z n Xd  d l m Z d  d l m Z m Z m Z d  d l m Z d e j f d „  ƒ  YZ d	 e j f d
 „  ƒ  YZ d e j f d „  ƒ  YZ e j e d ƒ d e j f d „  ƒ  Yƒ Z e j e j d k d ƒ d e j f d „  ƒ  Yƒ Z d e j f d „  ƒ  YZ d „  Z e  d k rÔe ƒ  n  d S(   iÿÿÿÿN(   t   array(   t   proxy(   t   test_support(   t   TESTFNt   run_unittestt   requires(   t   UserListt   AutoFileTestsc           B   s˜   e  Z d  „  Z d „  Z d „  Z d „  Z d „  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  t d ƒ |  _ d  S(   Nt   wb(   t   openR   t   f(   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_file2k.pyt   setUp   s    c         C   s*   |  j  r |  j  j ƒ  n  t j t ƒ d  S(   N(   R
   t   closet   ost   removeR   (   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_file2k.pyt   tearDown   s    	c         C   sk   t  |  j ƒ } | j d ƒ |  j |  j j ƒ  | j ƒ  ƒ |  j j ƒ  d  |  _ |  j t t	 | d ƒ d  S(   Nt
   teststringt   tell(
   R   R
   t   writet   assertEqualR   R   t   Nonet   assertRaisest   ReferenceErrort   getattr(   R   t   p(    (    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_file2k.pyt   testWeakRefs    s    	c      	   C   sŠ   |  j  } t j ƒ  � | j } Wd  QX| j | j | j t j ƒ  � | | _ Wd  QXx- d D]% } |  j t t	 f t
 | | d ƒ q] Wd  S(   Nt   namet   modet   closedt   oops(   R   R   R   (   R
   R   t   check_py3k_warningst	   softspaceR   R   R   R   t   AttributeErrort	   TypeErrort   setattr(   R   R
   R    t   attr(    (    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_file2k.pyt   testAttributes)   s    	c         C   sn   |  j  j d ƒ |  j  j ƒ  t d d ƒ } t t d ƒ |  _  |  j  j | ƒ } |  j d | j ƒ  |  ƒ d  S(   Nt   12t   ct   xi
   t   rbt
   xxxxxxxxxx(	   R
   R   R   R    R	   R   t   readintoR   t   tostring(   R   t   at   n(    (    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_file2k.pyt   testReadinto:   s    c         C   sd   t  d d g ƒ } |  j j | ƒ |  j j ƒ  t t d ƒ |  _ |  j j ƒ  } |  j | d ƒ d  S(   Nt   1t   2R)   R&   (   R   R
   t
   writelinesR   R	   R   t   readR   (   R   t   lt   buf(    (    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_file2k.pyt   testWritelinesUserListC   s    c         C   s&   |  j  t |  j j d d d g ƒ d  S(   Ni   i   i   (   R   R"   R
   R2   (   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_file2k.pyt   testWritelinesIntegersL   s    c         C   s2   t  d d d g ƒ } |  j t |  j j | ƒ d  S(   Ni   i   i   (   R   R   R"   R
   R2   (   R   R4   (    (    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_file2k.pyt   testWritelinesIntegersUserListP   s    c         C   s<   d d d „  ƒ  Y} |  j  t |  j j | ƒ  | ƒ  g ƒ d  S(   Nt	   NonStringc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    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_file2k.pyR9   W   s   (    (   R   R"   R
   R2   (   R   R9   (    (    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_file2k.pyt   testWritelinesNonStringU   s    c         C   s^   |  j  j t d d ƒ g ƒ |  j  j ƒ  t t d ƒ |  _  |  j  j ƒ  } |  j | d ƒ d  S(   NR'   t   abcR)   (   R
   R2   R    R   R	   R   R3   R   (   R   R5   (    (    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_file2k.pyt   testWritelinesBuffer]   s
    c         C   s�   |  j  t |  j ƒ j d t ƒ ƒ t j d k r8 d n d } t | d ƒ �: } |  j t	 j
 | ƒ |  j  t | ƒ j d | ƒ ƒ Wd  QXd  S(   Ns   <open file 't   win32s   xxxx
xx'xx"xxs   xx'xxt   ws   <open file %r, mode 'w' at(   t
   assertTruet   reprR
   t
   startswithR   t   syst   platformR	   t
   addCleanupR   R   (   R   t   fnameR
   (    (    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_file2k.pyt   testReprd   s    #c         C   s”   |  j  j ƒ  t t d ƒ |  _  |  j  } |  j | j t ƒ |  j | j ƒ  ƒ |  j | j ƒ |  j	 t
 | j d ƒ | j ƒ  |  j | j ƒ d  S(   NR)   t    (   R
   R   R	   R   R   R   RA   t   isattyR   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_file2k.pyt
   testErrorso   s    	
c         C   sq  d d d d d d d d d	 d
 d d d g } d g } t  j j d ƒ rX | j d ƒ n  |  j j d  d  d  ƒ |  j |  j j ƒ x0 | D]( } t	 |  j | ƒ } |  j
 t | ƒ qˆ Wt j ƒ  �8 x0 | D]( } t	 |  j | ƒ } |  j
 t | ƒ qÈ WWd  QX|  j
 t |  j j g  ƒ |  j |  j j d  d  d  ƒ d  ƒ y d d Wn) |  j |  j j t  j ƒ  Œ  d  ƒ n Xd  S(   Nt   filenot   flushRJ   t   nextR3   R+   t   readlinet	   readlinest   seekR   t   truncateR   t   __iter__t
   xreadlinest   atheosi   i    (   RD   RE   RC   R   R
   t   __exit__R   RA   R   R   R   t
   ValueErrorR   R   R2   R   t   exc_info(   R   t   methodst   deprecated_methodst
   methodnamet   method(    (    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_file2k.pyt   testMethods{   s*    	"c         C   s   |  j  t |  j j ƒ d  S(   N(   R   t   IOErrorR
   R3   (   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_file2k.pyt   testReadWhenWriting™   s    c            s/   ‡  f d †  } ˆ  j  t ˆ  j j | ƒ  ƒ d  S(   Nc          3   sB   x; t  d ƒ D]- }  |  d k r/ ˆ  j j ƒ  n  t |  ƒ Vq Wd  S(   Ni   i   (   t   rangeR
   R   t   str(   t   i(   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_file2k.pyt   nasty�   s    (   R   RW   R
   R2   (   R   Rc   (    (   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_file2k.pyt   testNastyWritelinesGeneratorœ   s    c            sü  d } xd d d d g D]} xb d d d g D]Q } t  t | ƒ ˆ  _ ˆ  j j | ƒ ˆ  j t t ˆ  j | ƒ ƒ ˆ  j j ƒ  q/ Wt  t | ƒ ˆ  _ ˆ  j j | ƒ ˆ  j t ‡  f d	 †  ƒ ˆ  j j ƒ  t  t | ƒ ˆ  _ ˆ  j j | ƒ ˆ  j t ˆ  j j t	 t
 | ƒ ƒ ƒ ˆ  j j ƒ  q WxÑ d
 d d d d d d d g D]± } t  t | ƒ ˆ  _ ˆ  j t ˆ  j j | ƒ ˆ  j j ƒ  t  t | ƒ ˆ  _ ˆ  j t ˆ  j j | | g ƒ ˆ  j j ƒ  t  t | ƒ ˆ  _ ˆ  j t ˆ  j j ƒ ˆ  j j ƒ  qCWd  S(   Nt   xxxR@   R   R-   t   abR3   RO   RP   c             s   g  ˆ  j  D] }  |  ^ q
 S(   N(   R
   (   t   line(   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_file2k.pyt   <lambda>±   RI   t   rR)   t   Ut   Ubt   Urt   rUt   rbUt   rUb(   R	   R   R
   R   R   R^   R   R   R+   t	   bytearrayt   lenR2   RR   (   R   t   dataR   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_file2k.pyt   testIssue5677¤   s2    %%(   R:   R;   R   R   R   R%   R/   R6   R7   R8   R<   R>   RH   RK   R]   R_   Rd   Rs   (    (    (    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_file2k.pyR      s    																		t   OtherFileTestsc           B   s¹   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 e j e j d	 k d
 ƒ d „  ƒ Z e j e j d k d ƒ e j d d d e ƒd „  ƒ ƒ Z RS(   c         C   sŽ   t  j j t ƒ p t  j } xl d D]d } y( | rC t | | ƒ } n t | ƒ } Wn& t k
 rx } |  j | j	 | ƒ q" X|  j
 d ƒ q" Wd  S(   NR@   s+   opening a directory didn't raise an IOError(   NR@   (   R   t   patht   dirnamet   __file__t   curdirR   R	   R^   R   t   filenamet   fail(   R   t   this_dirR   R
   t   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_file2k.pyt   testOpenDirÈ   s    c         C   s¸   xP d D]H } y t  t | ƒ } Wn t k
 r3 q X| j ƒ  |  j d | ƒ q Wx^ t t t ƒ t t d ƒ f D]= } y t  | d ƒ } Wn t t f k
 r¥ qs X| j ƒ  qs Wd  S(   NRI   t   aUs   wU+s   %r is an invalid file modes   	t   rr(   RI   R~   s   wU+(   R	   R   RW   R   Rz   t   unicodeR^   (   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_file2k.pyt   testModeStringsÕ   s    
&c         C   s[   t  j d k r |  j d ƒ n  t  j j ƒ  s> |  j d ƒ n  |  j t t  j j d ƒ d  S(   Nt   osf1V5sI   Skipping sys.stdin.seek(-1), it may crash the interpreter. Test manually.s    stdin must be a TTY in this testiÿÿÿÿ(   RD   RE   t   skipTestt   stdinRJ   R   R^   RQ   (   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_file2k.pyt   testStdinSeekê   s
    c         C   s   |  j  t t j j ƒ d  S(   N(   R   R^   RD   R„   RR   (   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_file2k.pyt   testStdinTruncate÷   s    c         C   sP   t  t t ƒ d ƒ } |  j t | ƒ j d t ƒ ƒ | j ƒ  t j t ƒ d  S(   NR@   s   <open file u'(	   R	   R€   R   RA   RB   RC   R   R   t   unlink(   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_file2k.pyt   testUnicodeOpenú   s     
c         C   sœ   d } y t  t | ƒ } Wna t k
 r| } | j d d k r˜ t | ƒ } t | k sb | | k ry |  j d | ƒ qy q˜ n X| j ƒ  |  j d | ƒ d  S(   Nt   qwertyi    s&   bad error message for invalid mode: %ss   no error for invalid mode: %s(   R	   R   RW   t   argsRa   Rz   R   (   R   t   bad_modeR
   t   msgt   s(    (    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_file2k.pyt   testBadModeArgument  s    
c         C   sÍ   xÆ d D]¾ } yu t  t d | ƒ } | j t | ƒ ƒ | j ƒ  | j ƒ  t  t d | ƒ } t | j ƒ  ƒ } | j ƒ  | j ƒ  Wn0 t k
 r´ } |  j d | t | ƒ f ƒ n X|  j	 | | ƒ q Wd  S(	   Niÿÿÿÿi    i   i   R@   Ri   s    error setting buffer size %d: %s(   iÿÿÿÿi    i   i   (
   R	   R   R   Ra   R   t   intR3   R^   Rz   R   (   R   R�   R
   t   dRŒ   (    (    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_file2k.pyt   testSetBufferSize  s    


!c            s<   t  j t ƒ ‡  f d †  } z | ƒ  Wd  t  j t ƒ Xd  S(   Nc             s  t  t d ƒ }  |  j d ƒ |  j ƒ  t  t d ƒ }  |  j d ƒ } | d k rd ˆ  j d | ƒ n  |  j ƒ  d k r� ˆ  j d |  j ƒ  ƒ n  |  j ƒ  |  j ƒ  d k rÆ ˆ  j d |  j ƒ  ƒ n  |  j ƒ  t j	 j
 t ƒ } | d k rˆ  j d	 | ƒ n  d  S(
   NR   t   12345678901s   rb+i   t   12345s(   Read on file opened for update failed %rs   File pos after read wrong %ds!   File pos after ftruncate wrong %ds"   File size after ftruncate wrong %d(   R	   R   R   R   R3   Rz   R   RR   R   Ru   t   getsize(   R
   Rr   t   size(   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_file2k.pyt	   bug801631%  s     


(   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_file2k.pyt   testTruncateOnWindows"  s
    c         C   sÖ  d } d } | t  | ƒ s) t d ƒ ‚ | t  | ƒ } d d d d d d	 g } d
 d f d d  f d d! f d t d d d ƒ f f g } z6t t d ƒ } | j | | ƒ | j | ƒ | j ƒ  x” | D]Œ \ } } t t ƒ }	 |	 j ƒ  | k r|  j	 d f n  t
 |	 | ƒ }
 y |
 | Œ  Wn t k
 r6n X|  j	 d | | f ƒ |	 j ƒ  qÌ Wt t ƒ }	 x t | ƒ D] } |	 j ƒ  quW| j d ƒ } y |	 j ƒ  } Wn t k
 rÈ|  j	 d ƒ n X| | k rï|  j	 d | | f ƒ n  | j d ƒ } t d d t  | ƒ ƒ } y |	 j | ƒ Wn t k
 rH|  j	 d ƒ n X| j ƒ  } | | k r{|  j	 d | | f ƒ n  | j d ƒ } y |	 j t  | ƒ ƒ } Wn t k
 rÃ|  j	 d ƒ n X| | k rê|  j	 d | | f ƒ n  y |	 j ƒ  } Wn t k
 r|  j	 d ƒ n X| | k rA|  j	 d | | f ƒ n  t t ƒ }	 ze x |	 D] } qWWy/ |	 j ƒ  |	 j | ƒ |	 j ƒ  |	 j ƒ  Wn t k
 r°|  j	 d ƒ n XWd  |	 j ƒ  XWd  t j t ƒ Xd  S("   Ni @  s   ham
s*   dataoffset must be multiple of len(filler)s   spam, spam and eggs
s   eggs, spam, ham and spam
s   saussages, spam, spam and eggs
s   spam, ham, spam and eggs
s(   spam, spam, spam, spam, spam, ham, spam
s   wonderful spaaaaaam.
RO   R3   RP   R+   R'   t    id   R@   s   Broken testfiles)   %s%r after next() didn't raise ValueErrori    sL   readline() after next() with supposedly empty iteration-buffer failed anywaysE   readline() after next() with empty buffer failed. Got %r, expected %rs    sL   readinto() after next() with supposedly empty iteration-buffer failed anywaysE   readinto() after next() with empty buffer failed. Got %r, expected %rsH   read() after next() with supposedly empty iteration-buffer failed anywaysA   read() after next() with empty buffer failed. Got %r, expected %rsM   readlines() after next() with supposedly empty iteration-buffer failed anywaysF   readlines() after next() with empty buffer failed. Got %r, expected %rs'   read* failed after next() consumed file(    (    (    (   Rq   t   AssertionErrorR    R	   R   R   R2   R   RN   Rz   R   RW   R`   t   popRO   R+   R,   R3   RP   R   R‡   (   R   t
   dataoffsett   fillert   nchunkst	   testlinesRY   t   bagR[   RŠ   R
   t   methRb   t   testlineRg   R5   t   lines(    (    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_file2k.pyt   testIterationA  sž    			
						

t   posixs   test requires a posix system.c         C   s  d } t  j j | ƒ o0 t j t  j | ƒ j ƒ sG |  j d | ƒ n  t | d d ƒ �* } |  j t	 ƒ � | j
 d ƒ Wd  QXWd  QXt | d d ƒ �7 } |  j t	 ƒ � | j
 d ƒ | j
 d ƒ Wd  QXWd  QXt | d d ƒ �* } |  j t	 ƒ � | j
 d	 ƒ Wd  QXWd  QXd  S(
   Ns	   /dev/fulls   requires %rR   i   s   hello
t   hellos   
i    t   h(   R   Ru   t   existst   statt   S_ISCHRt   st_modeRƒ   R	   R   R^   R   (   R   t   devfullR
   (    (    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_file2k.pyt   test_write_full°  s    i   i   s   requires 64-bit systemg      @t   dry_runc         C   s¢   t  d ƒ t t d ƒ �% } | j | d ƒ | j d ƒ Wd  QXt t d ƒ � } x | D] } qY WWd  QX|  j t | ƒ | ƒ |  j | j d ƒ | ƒ d  } d  S(   Nt	   largefileR   i   s    R)   (	   R   R	   R   RQ   R   R   Rq   t   countR   (   R   R•   t   fpR4   (    (    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_file2k.pyt   test_very_long_lineÃ  s    

I   €    I   €    (   R:   R;   R}   R�   R…   R†   Rˆ   RŽ   R‘   R—   R£   t   unittestt
   skipUnlessR   R   R¬   RD   t   maxsizeR   t   precisionbigmemtestt   FalseR±   (    (    (    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_file2k.pyRt   Æ   s   									o$t   FileSubclassTestsc           B   s   e  Z d  „  Z RS(   c         C   sB   d t  f d „  ƒ  Y} | t d ƒ � } Wd  QX|  j | j ƒ d  S(   Nt   Cc           B   s   e  Z d  „  Z d „  Z RS(   c         W   s   t  |  _ t j |  | Œ d  S(   N(   R¶   t   subclass_closedt   filet   __init__(   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_file2k.pyR»   ×  s    	c         S   s   t  |  _ t j |  ƒ d  S(   N(   t   TrueR¹   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_file2k.pyR   Ú  s    	(   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_file2k.pyR¸   Ö  s   	R@   (   Rº   R   RA   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_file2k.pyt   testExitÔ  s    (   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_file2k.pyR·   Ò  s   s!   Threading required for this test.t   FileThreadingTestsc           B   sæ   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d d „ Z d	 „  Z	 d
 „  Z
 d „  Z d „  Z d „  Z d „  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  j ƒ  |  _ d  |  _ t |  _ t |  j d ƒ � } | j d j	 d ƒ ƒ Wd  QXt
 j ƒ  |  _ d |  _ d |  _ t |  _ d  S(   NR@   s   
t
   0123456789i    (   R   t   threading_setupt   _threadsR   R
   R   Ry   R	   R   t   joint	   threadingt   Lockt   _count_lockt   close_countt   close_success_countR¶   t   use_buffering(   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_file2k.pyR   é  s    				c         C   ss   |  j  r7 y |  j  j ƒ  Wq7 t t f k
 r3 q7 Xn  y t j |  j ƒ Wn t k
 r^ n Xt j |  j	 Œ  d  S(   N(
   R
   R   t   EnvironmentErrorRW   R   R   Ry   R   t   threading_cleanupRÁ   (   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_file2k.pyR   ô  s    	c         C   s@   |  j  r' t |  j d d d ƒ|  _ n t |  j d ƒ |  _ d  S(   Ns   w+t	   bufferingi   i   i @  (   RÈ   R	   Ry   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_file2k.pyt   _create_file   s    	c         C   sO   |  j  � |  j d 7_ Wd  QX|  j j ƒ  |  j  � |  j d 7_ Wd  QXd  S(   Ni   (   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_file2k.pyt   _close_file  s
    

c         C   s   |  j  ƒ  |  j ƒ  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_file2k.pyt   _close_and_reopen_file  s    
gš™™™™™É?c      	   C   s  |  j  � d |  _ d |  _ Wd  QXt |  _ g  } z· x= t | ƒ D]/ } t j d | ƒ } | j ƒ  | j	 | ƒ qA Wxc t
 d ƒ D]U } t j | d ƒ |  j  �3 |  j |  j | d k rÐ t j rÌ d Gn  Pn  Wd  QXq� Wt j | ƒ Wd  t |  _ x | D] } | j ƒ  qû WXd  S(   Ni    t   targetid   i   t   Q(   RÅ   RÆ   RÇ   R¼   t   do_continueR`   RÃ   t   Threadt   startt   appendt   xranget   timet   sleepR   t   verboseR¶   RÂ   (   R   t   funct
   nb_workerst   durationt   threadsRb   t   tt   _(    (    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_file2k.pyt   _run_workers  s*    
		

		i   c            sY   ‡  ‡ f d †  } ˆ j  | | ƒ t j rU d d ˆ j ˆ j } ˆ j Gd | Gn  d  S(   Nc             sx   ˆ j  ƒ  t j ‡  f d †  ‡ f d †  f ƒ }  x@ |  D]8 } ˆ j sK Pn  y | ƒ  Wq8 t t f k
 ro q8 Xq8 Wd  S(   Nc              s   ˆ  ƒ  S(   N(    (    (   t   io_func(    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_file2k.pyRh   /  RI   c              s
   ˆ  j  ƒ  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_file2k.pyRh   0  RI   (   RÌ   t	   itertoolst   cycleRÑ   R^   RW   (   t   funcsR
   (   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_file2k.pyt   worker,  s    
	g      Y@s   %.4f (   Rß   R   RØ   RÇ   RÆ   (   R   Rà   RÚ   Rä   t   percent(    (   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_file2k.pyt   _test_close_open_io+  s
    	c         C   s   d „  } |  j  | ƒ d  S(   Nc           S   s   d  S(   N(    (    (    (    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_file2k.pyRà   C  s    (   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_file2k.pyt   test_close_openB  s    	c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  d  S(   N(   R
   RM   (    (   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_file2k.pyRà   H  s    (   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_file2k.pyt   test_close_open_flushG  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   t  t ˆ  j ƒ ƒ d  S(   N(   t   listt   iterR
   (    (   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_file2k.pyRà   M  s    (   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_file2k.pyt   test_close_open_iterL  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  d  S(   N(   R
   RJ   (    (   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_file2k.pyRà   R  s    (   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_file2k.pyt   test_close_open_isattyQ  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  d IJd  S(   NRI   (   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_file2k.pyRà   W  s    (   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_file2k.pyt   test_close_open_printV  s    c            s)   t  ˆ  _ ‡  f d †  } ˆ  j | ƒ d  S(   Nc              s   ˆ  j  d IJd  S(   NRI   (   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_file2k.pyRà   ]  s    (   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_file2k.pyt   test_close_open_print_buffered[  s    	c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j d ƒ d  S(   Ni    (   R
   R3   (    (   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_file2k.pyRà   b  s    (   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_file2k.pyt   test_close_open_reada  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc             s#   t  d d ƒ }  ˆ  j j |  ƒ d  S(   NR'   t   xxxxx(   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_file2k.pyRà   g  s    (   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_file2k.pyt   test_close_open_readintof  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  d  S(   N(   R
   RO   (    (   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_file2k.pyRà   m  s    (   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_file2k.pyt   test_close_open_readlinel  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  d  S(   N(   R
   RP   (    (   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_file2k.pyRà   r  s    (   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_file2k.pyt   test_close_open_readlinesq  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j d d ƒ d  S(   Ni    (   R
   RQ   (    (   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_file2k.pyRà   w  s    (   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_file2k.pyt   test_close_open_seekv  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  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_file2k.pyRà   |  s    (   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_file2k.pyt   test_close_open_tell{  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j ƒ  d  S(   N(   R
   RR   (    (   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_file2k.pyRà   �  s    (   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_file2k.pyt   test_close_open_truncate€  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j d ƒ d  S(   NRI   (   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_file2k.pyRà   †  s    (   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_file2k.pyt   test_close_open_write…  s    c            s    ‡  f d †  } ˆ  j  | ƒ d  S(   Nc              s   ˆ  j  j d ƒ d  S(   NRI   (   R
   R2   (    (   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_file2k.pyRà   ‹  s    (   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_file2k.pyt   test_close_open_writelinesŠ  s    c            s…   t  |  j d ƒ �3 } x) t d
 ƒ D] } | j d d d ƒ q" WWd  QXt  |  j d ƒ �& ‰  ‡  f d †  } |  j | d	 ƒ Wd  QXd  S(   NR   i   i   t   0i2   s   
R)   c             s   x ˆ  D] }  q Wd  S(   N(    (   R4   (   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_file2k.pyt   it•  s    i
   i   (   R	   Ry   RÕ   R   Rß   (   R   R°   Rb   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_file2k.pyt   test_iteration_torture�  s    c      	      s¢   t  |  j d ƒ �3 } x) t d ƒ D] } | j d d d ƒ q" WWd  QXt  |  j d ƒ �C ‰  t d g d g d	 ƒ ‰ ‡  ‡ f d
 †  } |  j | d	 ƒ Wd  QXd  S(   NR   i'  Rù   i2   s   
R)   i   i    i
   c             sO   t  ˆ ƒ r  x< ˆ  D] }  q Wn+ x( t d ƒ D] } ˆ  j | d d ƒ q- Wd  S(   Nid   i    (   RN   RÕ   RQ   (   R4   Rb   (   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_file2k.pyt   iterate¡  s
    (   R	   Ry   RÕ   R   Rê   Rß   (   R   R°   Rb   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_file2k.pyt   test_iteration_seekš  s    (   R:   R;   R   R   RÌ   RÍ   RÎ   Rß   Ræ   Rç   Rè   Rë   Rì   Rí   Rî   Rï   Rñ   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_file2k.pyR¾   ã  s0   																					R¤   s   test requires a posix system.t   TestFileSignalEINTRc           B   sP   e  Z e d  „ Z e d „ Z d „  Z e d „ Z d „  Z d „  Z d „  Z	 RS(   c         C   s  | r! | j  d d ƒ } d } n d } t | ƒ d k  sE t d ƒ ‚ d | d d	 | } t j t j d
 | g d t j d t j d t j ƒ} | j j	 d ƒ } | d k rà | j
 ƒ  |  j d | | | j j	 ƒ  f ƒ n  | j j | ƒ d }	 g  }
 x‚ |
 s€t j | j g d d d ƒ \ }
 } } | j t j ƒ t j d ƒ |	 d 7}	 |	 d k rÿ | j
 ƒ  |  j d | ƒ qÿ qÿ W| j j ƒ  } | d k rÍ| j
 ƒ  |  j d | | | j j	 ƒ  f ƒ n  | j d d ƒ \ } } | j d k r|  j d | | j | | f ƒ n  d S(   sk  Generic buffered read method test harness to verify EINTR behavior.

        Also validates that Python signal handlers are run during the read.

        Args:
            data_to_write: String to write to the child process for reading
                before sending it a signal, confirming the signal was handled,
                writing a final newline char and closing the infile pipe.
            read_and_verify_code: Single "line" of code to read from a file
                object named 'infile' and validate the result.  This will be
                executed as part of a python subprocess fed data_to_write.
            method_name: The name of the read method being tested, for use in
                an error message on failure.
            universal_newlines: If True, infile will be opened in universal
                newline mode in the child process.
        s   
s   
s,   infile = os.fdopen(sys.stdin.fileno(), "rU")s   infile = sys.stdini   s#   data_to_write must fit in pipe buf.s\   import os, signal, sys ;signal.signal(signal.SIGINT, lambda s, f: sys.stderr.write("$\n")) ;s    ;s<   assert isinstance(infile, file) ;sys.stderr.write("Go.\n") ;s   -cR„   t   stdoutt   stderri   s   Go.
s-   Error from %s process while awaiting "Go":
%si    gš™™™™™©?gš™™™™™¹?i   iÈ   s"   failed to handle signal during %s.s   $
s/   Error from %s process while awaiting signal:
%st   inputs0   %s() process exited rc=%d.
STDOUT:
%s
STDERR:
%sN(    (    (   t   replaceRq   R™   t
   subprocesst   PopenRD   t
   executablet   PIPER   R3   t   killRz   R„   R   t   selectt   send_signalt   signalt   SIGINTRÖ   R×   RO   t   communicatet
   returncode(   R   t   data_to_writet   read_and_verify_codet   method_namet   universal_newlinest   infile_setup_codet
   child_codet   reader_processt   got   signals_sentt   rlistRÞ   t   signal_lineRÿ   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_file2k.pyt   _test_reading­  sF    		
		'


		c      	   C   s&   |  j  d d d d d d d | ƒ d S(	   s4   file.readline must handle signals and not lose data.R  s   hello, world!R  sŠ   line = infile.readline() ;expected_line = "hello, world!\n" ;assert line == expected_line, ("read %r expected %r" % (line, expected_line))R  RO   R  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_file2k.pyt   test_readlineý  s
    	c         C   s   |  j  d t ƒ d  S(   NR  (   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_file2k.pyt%   test_readline_with_universal_newlines
  s    c      	   C   s&   |  j  d d d d d d d | ƒ d S(	   s5   file.readlines must handle signals and not lose data.R  s   hello
world!R  sÁ   lines = infile.readlines() ;expected_lines = ["hello\n", "world!\n"] ;assert lines == expected_lines, ("readlines returned wrong data.\n" "got lines %r\nexpected  %r" % (lines, expected_lines))R  RP   R  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_file2k.pyt   test_readlines  s
    	c         C   s   |  j  d t ƒ d  S(   NR  (   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_file2k.pyt&   test_readlines_with_universal_newlines  s    c         C   s    |  j  d d d d d d ƒ d S(   s<   Unbounded file.read() must handle signals and not lose data.R  s   hello, world!abcdefghijklmR  s’   data = infile.read() ;expected_data = "hello, world!abcdefghijklm\n";assert data == expected_data, ("read %r expected %r" % (data, expected_data))R  s   unbounded readN(   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_file2k.pyt   test_readall  s    	c         C   s    |  j  d d d d d d ƒ d S(   s4   file.readinto must handle signals and not lose data.R  s   hello, world!R  s²   data = bytearray(50) ;num_read = infile.readinto(data) ;expected_data = "hello, world!\n";assert data[:num_read] == expected_data, ("read %r expected %r" % (data, expected_data))R  R+   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_file2k.pyt   test_readinto+  s    	(
   R:   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_file2k.pyRþ   «  s   O			t   StdoutTestsc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c            sH   t  j ‰  d d ‡  f d †  ƒ  Y} z | ƒ  t  _ d GHWd  ˆ  t  _ Xd  S(   Nt   Filec              s   e  Z ‡  f d  †  Z RS(   c            s   d | k r ˆ  t  _ n  d  S(   Ns   
(   RD   Rÿ   (   R   Rr   (   t   save_stdout(    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_file2k.pyR   A  s    (   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_file2k.pyR!  @  s   s	   some text(    (   RD   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_file2k.pyt   test_move_stdout_on_write;  s    		c         C   sb   t  j } t  ` zB y HWn) t k
 rB } |  j t | ƒ d ƒ n X|  j d ƒ Wd  | t  _ Xd  S(   Ns   lost sys.stdouts   Expected RuntimeError(   RD   Rÿ   t   RuntimeErrorR   Ra   Rz   (   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_file2k.pyt   test_del_stdout_before_printK  s    	 c            sÎ   d d  l  ‰ ‡ ‡ f d †  ‰  ‡  ‡ f d †  } | d d d ƒ | d d d ƒ | d d	 d
 ƒ | d d d ƒ | d d d ƒ | d d d ƒ x7 d D]/ } ˆ  d d d | d ƒ } ˆ j | d ƒ q— Wd  S(   Niÿÿÿÿc            s{   d j  | ƒ } t j j ƒ  } |  | d <ˆ j t j d | g d ˆ j d | ƒ} | j ƒ  \ } } ˆ  j	 | j
 d ƒ | S(   Ns   
t   PYTHONIOENCODINGs   -cRÿ   t   envi    (   RÂ   R   t   environt   copyR  RD   R  R  R  R   R  (   t   encodingt   codeR'  t   processRÿ   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_file2k.pyt   get_message\  s    
c            s-   ˆ  | d d |  d ƒ } ˆ j  | | ƒ d  S(   Ns
   import syss   sys.stdout.write(%r)s   sys.stdout.flush()(   R   (   t   textR*  t   expectedRÿ   (   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_file2k.pyt   check_messagef  s
    	u   15â‚¬s   iso-8859-15s   15¤s   utf-8s   15â‚¬s	   utf-16-les   1 5 ¬ s   iso-8859-1:ignoret   15s   iso-8859-1:replaces   15?s   iso-8859-1:backslashreplaces   15\u20act   bufferRp   t   asciis
   import syss   sys.stdout.write(%s("\xe9"))s   sys.stdout.flush()s   é(   R2  Rp   (   R  R   (   R   R0  t   objtypeRÿ   (    (   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_file2k.pyt   test_unicodeY  s    
	(   R:   R;   R#  R%  R5  (    (    (    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_file2k.pyR   9  s   		c           C   sG   z t  t t t t t t ƒ Wd  t j j	 t
 ƒ rB t j t
 ƒ n  Xd  S(   N(   R   R   Rt   R·   R¾   Rþ   R   R   Ru   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_file2k.pyt	   test_main€  s
    t   __main__(!   RD   R   R²   Rá   R  R
  R¨   R  RÖ   R    t   weakrefR   RÃ   t   ImportErrorR   t   testR   t   test.test_supportR   R   R   R   t   TestCaseR   Rt   R·   R³   R¾   R   Rþ   R   R6  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_file2k.pyt   <module>   s:   
±ÿ Ç�G	
