
&]\c           @   s   d  Z  d d l Z y d d l m Z Wn e k
 r9 n Xd d l Z d d l m Z d d l	 Z	 d d l
 Z d d l Z d d l m Z d d l Z e	 j j e j d k  d d	 d
 e f d     Y Z d S(   sK   
Ensure that we can use pathlib.Path objects in all relevant IO functions.
iN(   t   Path(   t   assert_(   t   tempdiri   i   t   reasons@   Passing path-like objects to IO functions requires Python >= 3.6t	   TestPathsc           B   st   e  Z e j d   j e j  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z RS(
   i   c      	   C   sS   t    D } t |  d } t j j | i |  j d 6 t | j    Wd  QXd  S(   Ns   data.matt   data(   R   R    t   scipyt   iot   savematR   R   t   is_file(   t   selft   temp_dirt   path(    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_savemat   s    c      	   C   sx   t    i } t |  d } t j j t |  i |  j d 6 t j j |  } t | d |  j k j	    Wd  QXd  S(   Ns   data.matR   (
   R   R    R   R   R   t   strR   t   loadmatR   t   all(   R
   R   R   t   mat_contents(    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_loadmat"   s
    #c      	   C   sx   t    i } t |  d } t j j t |  i |  j d 6 t j j |  } t | d d d d f k  Wd  QXd  S(   Ns   data.matR   i    i   i   t   int64(   i   i   (	   R   R    R   R   R   R   R   t   whosmatR   (   R
   R   R   t   contents(    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_whosmat+   s
    #c         C   s'   t  t  j d } t j j |  d  S(   Ns   data/scalar_string.sav(   R    t   __file__t   parentR   R   t   readsav(   R
   R   (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_readsav4   s    c         C   s   t     } t j j t j j d   } t |  d } t j j j t	 |  |  t j j j
 |  } t | | k j d k  Wd  QXd  S(   Ni   s   data.hbi    (   R   R   t   sparset
   csr_matrixt   eyeR    R   t   harwell_boeingt   hb_writeR   t   hb_readR   t   nnz(   R
   R   R   R   t   data_new(    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_hb_read8   s    c         C   sj   t    [ } t j j t j j d   } t |  d } t j j j | |  t	 | j
    Wd  QXd  S(   Ni   s   data.hb(   R   R   R   R   R   R    R   R   R   R   R	   (   R
   R   R   R   (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_hb_writeB   s
    c         C   s*   t  t  j d } t j j j |  d  S(   Ns   data/example_1.nc(   R    R   R   R   R   t   netcdft   netcdf_file(   R
   R   (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_netcdf_fileI   s    c         C   s*   t  t  j d } t j j j |  d  S(   Ns"   data/test-8000Hz-le-2ch-1byteu.wav(   R    R   R   R   R   t   wavfilet   read(   R
   R   (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_wavfile_readM   s    c         C   sv   t  t  j d } t j j j t |   \ } } t   3 } t  |  | j	 } t j j j
 | | |  Wd  QXd  S(   Ns"   data/test-8000Hz-le-2ch-1byteu.wav(   R    R   R   R   R   R(   R)   R   R   t   namet   write(   R
   t
   input_patht   rateR   R   t   output_path(    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   test_wavfile_writeQ   s
    !(   t   __name__t
   __module__t   npt   aranget   astypeR   R   R   R   R   R   R#   R$   R'   R*   R0   (    (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyR      s   							
			(   i   i   (   t   __doc__t   syst   pathlibR    t   ImportErrort   numpyR3   t   numpy.testingR   t   pytestt   scipy.ioR   t   scipy.io.wavfilet   scipy._lib._tmpdirsR   t   scipy.sparset   markt   skipift   version_infot   objectR   (    (    (    s8   lib/python2.7/site-packages/scipy/io/tests/test_paths.pyt   <module>   s   	