ó
Ê½÷Xc           @   s»   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
 m Z m Z m Z m Z m Z d „  Z d „  Z d „  Z d „  Z d „  Z e d	 k r· e ƒ  n  d S(
   iÿÿÿÿN(   t   assert_array_almost_equalt   run_module_suitet   assert_(   t
   csc_matrixt
   csr_matrixt
   bsr_matrixt
   dia_matrixt
   coo_matrixt   save_npzt   load_npzc         C   sW   t  j d d ƒ \ } } t j | ƒ z t | |  ƒ t | ƒ } Wd  t j | ƒ X| S(   Nt   suffixs   .npz(   t   tempfilet   mkstempt   ost   closeR   R	   t   remove(   t   matrixt   fdt   tmpfilet   loaded_matrix(    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   _save_and_load
   s    c         C   s‘   xŠ t  t t t t g D]s } | |  ƒ } t | ƒ } t t | ƒ | k ƒ t | j |  j k ƒ t | j	 |  j	 k ƒ t
 | j ƒ  |  ƒ q Wd  S(   N(   R   R   R   R   R   R   R   t   typet   shapet   dtypeR    t   toarray(   t   dense_matrixt   matrix_classR   R   (    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   _check_save_and_load   s    c          C   sL   d }  t  j j d ƒ t  j j |  |  f ƒ } d | | d k <t | ƒ d  S(   Ni
   i    gffffffæ?(   t   npt   randomt   seedR   (   t   NR   (    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   test_save_and_load_random   s
    c          C   s   t  j d ƒ }  t |  ƒ d  S(   Ni   i   (   i   i   (   R   t   zerosR   (   R   (    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   test_save_and_load_empty$   s    c          C   s'   t  j d ƒ }  d |  d <t |  ƒ d  S(   Ni   i   i   i   (   i   i   (   i   i   (   R   R!   R   (   R   (    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   test_save_and_load_one_entry(   s    
t   __main__(   R   t   numpyR   R   t   numpy.testingR    R   R   t   scipy.sparseR   R   R   R   R   R   R	   R   R   R    R"   R#   t   __name__(    (    (    s@   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/tests/test_matrix_io.pyt   <module>   s   4	
					