ó
Œ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 m Z m Z m	 Z	 d  d l m
 Z
 m Z y e	 j e
 ƒ Z Wn& e e f k
 rµ e j d ƒ ‚ n Xe j e
 ƒ e	 k rCd  d l Z y@ e d e j ƒ  ƒ Z	 e	 j e
 ƒ Z d e k re d ‚ n  WqCe e f k
 r?e j d ƒ ‚ qCXn  e j e
 ƒ e	 k rje j d	 ƒ ‚ n  d
 „  Z d e j f d „  ƒ  YZ d „  Z e d k r«e ƒ  n  d S(   iÿÿÿÿN(   t   run_unittestt
   change_cwdt   TESTFN_UNICODE(   t   TESTFN_ENCODINGt   TESTFN_UNENCODABLEs1   No Unicode filesystem semantics on this platform.s   @test-àòt   ?s   mbcs encoding problems!   Cannot find a suiteable filename.s    Cannot find a suitable filename.c         C   s&   t  j j |  ƒ r" t  j |  ƒ n  d  S(   N(   t   ost   patht   existst   unlink(   t   filename(    (    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_unicode_file.pyt   remove_if_exists"   s    t   TestUnicodeFilesc           B   sY   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   s'  |  j  t j j | ƒ ƒ |  j  t j j | ƒ ƒ |  j  t j | t j ƒ ƒ |  j  t j j t j j | ƒ ƒ ƒ |  j  t j j t j j | ƒ ƒ ƒ |  j  t j t j j | ƒ t j ƒ ƒ t j | d ƒ t j	 | d  ƒ t j	 | t j ƒ  t j ƒ  f ƒ |  j | | ƒ |  j  t j j | ƒ t j j t j | ƒ d ƒ k ƒ t j j t j j | ƒ ƒ \ } } t | t ƒ r�| j t ƒ } n  t j | ƒ } | rÜt | d t ƒ rÜg  | D] } | j t ƒ ^ q¾} n  t j d | ƒ } g  | D] } t j d | ƒ ^ qõ} |  j | | ƒ d  S(   Niÿ  i    t   NFD(   t
   assertTrueR   R   R   t   isfilet   accesst   R_OKt   abspatht   chmodt   utimet   Nonet   timet   _do_copyisht   globt   splitt
   isinstancet   strt   decodeR   t   listdirt   unicodedatat	   normalizet   assertIn(   t   selfR
   R   t   baset	   file_listt   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_unicode_file.pyt
   _do_single,   s*    %%("2$%%c         C   sz   |  j  t | ƒ t | ƒ k d ƒ |  j t j | ƒ t j | ƒ ƒ |  j t j | ƒ t j | ƒ ƒ |  j | | ƒ d  S(   Ns7   No point checking equivalent filenames of the same type(   R   t   typet   assertEqualR   t   statt   lstatR   (   R!   t	   filename1t	   filename2(    (    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_unicode_file.pyt   _do_equivalentN   s    c         C   s   |  j  t j j | ƒ ƒ t j | | d ƒ |  j  t j j | d ƒ ƒ t j | d | ƒ |  j  t j j | ƒ ƒ t j | | d ƒ t j | d ƒ t j | | d ƒ |  j  t j j	 | ƒ ƒ t j | d | ƒ |  j  t j j	 | ƒ ƒ t j
 | | d ƒ t j | d ƒ d  S(   Ns   .new(   R   R   R   R   t   renamet   shutilt   copyR	   t   moveR   t   copy2(   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_unicode_file.pyR   ]   s    c         C   sÚ   t  j j | ƒ r" t  j | ƒ n  t  j | ƒ z– t | ƒ �„ | sZ t  j ƒ  } | } n$ t  j ƒ  j t	 ƒ } | j t	 ƒ } t
 j d | ƒ } t
 j d | ƒ } |  j t  j j | ƒ | ƒ Wd  QXWd  t  j | ƒ Xd  S(   NR   (   R   R   t   isdirt   rmdirt   mkdirR   t   getcwdut   getcwdR   R   R   R   R'   t   basename(   R!   t	   make_namet
   chdir_namet   encodedt
   cwd_resultt   name_result(    (    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_unicode_file.pyt   _do_directoryt   s    	&c         C   s§   t  | ƒ t | d ƒ } | j ƒ  z |  j | ƒ Wd  t j | ƒ X|  j t j j | ƒ ƒ t j	 | t j
 ƒ } t j | ƒ z |  j | ƒ Wd  t j | ƒ Xd  S(   Nt   w(   R   t   filet   closeR%   R   R	   R   R   R   t   opent   O_CREAT(   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_unicode_file.pyt   _test_singleŠ   s    

c         C   sf   t  | ƒ |  j t j j | ƒ ƒ t | d ƒ } | j ƒ  z |  j | | ƒ Wd  t j | ƒ Xd  S(   NR>   (	   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_unicode_file.pyt   _test_equivalent›   s    

c         C   s:   |  j  t ƒ |  j  t ƒ t d  k	 r6 |  j  t ƒ n  d  S(   N(   RC   t   TESTFN_ENCODEDR   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_unicode_file.pyt   test_single_files§   s    c         C   s$   |  j  t t ƒ |  j  t t ƒ d  S(   N(   RD   RE   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_unicode_file.pyt   test_equivalent_files­   s    c         C   s    d } |  j  t | t | t ƒ |  j  t | t | t ƒ |  j  t | t | t ƒ |  j  t | t | t ƒ t d  k	 rœ |  j  t | t | t ƒ n  d  S(   Ns   .dir(   R=   RE   t   TrueR   t   FalseR   R   (   R!   t   ext(    (    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_unicode_file.pyt   test_directories±   s    (   t   __name__t
   __module__R%   R,   R   R=   RC   RD   RF   RG   RK   (    (    (    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_unicode_file.pyR   &   s   	"							c           C   s   t  t ƒ d  S(   N(   R    RL   (    (    (    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_unicode_file.pyt	   test_mainÀ   s    t   __main__(   R   R   R   R.   R   t   unittestt   test.test_supportR    R   R   R   R   t   encodeRE   t   UnicodeErrort	   TypeErrort   SkipTestR   t   syst   unicodet   getfilesystemencodingR   t   TestCaseR   RN   RL   (    (    (    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_unicode_file.pyt   <module>   s0   0	š	