ó
Ð4¹[c           @   su  d  d l  Z  d  d l Z y d  d l m Z WnO e k
 r} y d  d l m Z Wq~ e k
 ry d e f d „  ƒ  YZ q~ Xn Xd d d d d	 d
 d d d d d d g Z d „  Z e	 d d „ Z d d „ Z d d „ Z e	 d d „ Z e	 d d „ Z e	 d d „ Z e	 d d „ Z d Z d d d „ Z d d „ Z e	 d d „ Z e	 d d „ Z e	 d d „ Z e	 d d „ Z d S(    iÿÿÿÿN(   t   PathR    c           B   s   e  Z d  Z RS(   s   Dummy for isinstance checks(   t   __name__t
   __module__t   __doc__(    (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR       s   t   assert_path_existst   assert_not_path_existst   assert_isfilet   assert_not_isfilet   assert_isdirt   assert_not_isdirt   assert_islinkt   assert_not_islinkt   assert_ispipet   assert_not_ispipet   assert_issockett   assert_not_issocketc         C   s   t  |  t ƒ r t |  ƒ S|  S(   N(   t
   isinstanceR    t   str(   t   p(    (    s/   lib/python2.7/site-packages/testpath/asserts.pyt   _strpath   s    
c         C   sc   | r t  j n t  j } y | |  ƒ SWn6 t k
 r^ | d  k rO d |  } n  t | ƒ ‚ n Xd  S(   Ns,   Path does not exist, or can't be stat-ed: %r(   t   ost   statt   lstatt   OSErrort   Nonet   AssertionError(   t   patht   follow_symlinkst   msgR   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyt   _stat_for_assert   s    c         C   s   t  t |  ƒ t | ƒ d S(   s4   Assert that something exists at the given path.
    N(   R   R   t   True(   R   R   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   &   s    c         C   sJ   t  |  ƒ }  t j j |  ƒ rF | d k r7 d |  } n  t | ƒ ‚ n  d S(   s2   Assert that nothing exists at the given path.
    s   Path exists: %rN(   R   R   R   t   existsR   R   (   R   R   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   +   s
    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ sX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÖ   Assert that path exists and is a regular file.
    
    With follow_symlinks=True, the default, this will pass if path is a symlink
    to a regular file. With follow_symlinks=False, it will fail in that case.
    s*   Path exists, but is not a regular file: %rN(   R   R   R   t   S_ISREGt   st_modeR   R   (   R   R   R   t   st(    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   4   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ rX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÚ   Assert that path exists but is not a regular file.
    
    With follow_symlinks=True, the default, this will fail if path is a symlink
    to a regular file. With follow_symlinks=False, it will pass in that case.
    s   Path is a regular file: %rN(   R   R   R   R    R!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   A   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ sX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÐ   Assert that path exists and is a directory.
    
    With follow_symlinks=True, the default, this will pass if path is a symlink
    to a directory. With follow_symlinks=False, it will fail in that case.
    s'   Path exists, but is not a directory: %rN(   R   R   R   t   S_ISDIRR!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   N   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ rX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÔ   Assert that path exists but is not a directory.
    
    With follow_symlinks=True, the default, this will fail if path is a symlink
    to a directory. With follow_symlinks=False, it will pass in that case.
    s   Path is a directory: %rN(   R   R   R   R#   R!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR	   [   s    sF   Symlink target of:
  {path}
Expected:
  {expected}
Actual:
  {actual}
c         C   sÎ   t  |  ƒ }  t |  t | ƒ } t j | j ƒ sX | d k rI d |  } n  t | ƒ ‚ n  | d k	 rÊ t  | ƒ } t j	 |  ƒ } | | k rÊ | d k r¸ t
 j d |  d | d | ƒ } n  t | ƒ ‚ qÊ n  d S(   s|   Assert that path exists and is a symlink.
    
    If to is specified, also check that it is the target of the symlink.
    s%   Path exists, but is not a symlink: %rR   t   expectedt   actualN(   R   R   t   FalseR   t   S_ISLNKR!   R   R   R   t   readlinkt   _link_target_msgt   format(   R   t   toR   R"   t   target(    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR
   p   s    !c         C   s\   t  |  ƒ }  t |  t | ƒ } t j | j ƒ rX | d k rI d |  } n  t | ƒ ‚ n  d S(   s2   Assert that path exists but is not a symlink.
    s   Path is a symlink: %rN(   R   R   R&   R   R'   R!   R   R   (   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   …   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ sX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÕ   Assert that path exists and is a named pipe (FIFO).

    With follow_symlinks=True, the default, this will pass if path is a symlink
    to a named pipe. With follow_symlinks=False, it will fail in that case.
    s(   Path exists, but is not a named pipe: %rN(   R   R   R   t   S_ISFIFOR!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR      s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ rX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÙ   Assert that path exists but is not a named pipe (FIFO).

    With follow_symlinks=True, the default, this will fail if path is a symlink
    to a named pipe. With follow_symlinks=False, it will pass in that case.
    s   Path is a named pipe: %rN(   R   R   R   R-   R!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   œ   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ sX | d k rI d |  } n  t | ƒ ‚ n  d S(   sÞ   Assert that path exists and is a Unix domain socket.

    With follow_symlinks=True, the default, this will pass if path is a symlink
    to a Unix domain socket. With follow_symlinks=False, it will fail in that case.
    s$   Path exists, but is not a socket: %rN(   R   R   R   t   S_ISSOCKR!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   ©   s    c         C   s\   t  |  ƒ }  t |  | | ƒ } t j | j ƒ rX | d k rI d |  } n  t | ƒ ‚ n  d S(   sâ   Assert that path exists but is not a Unix domain socket.

    With follow_symlinks=True, the default, this will fail if path is a symlink
    to a Unix domain socket. With follow_symlinks=False, it will pass in that case.
    s   Path is a socket: %rN(   R   R   R   R.   R!   R   R   (   R   R   R   R"   (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyR   ¶   s    (   R   R   t   pathlibR    t   ImportErrort   pathlib2t   objectt   __all__R   R   R   R   R   R   R   R   R   R	   R)   R
   R   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/testpath/asserts.pyt   <module>   s:   			
