σ
¦Υ\c           @` s‘  d  d l  m Z m Z m Z d  d l Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z d  d l m Z e e d d	 Z i d
 d 6d d 6Z d j g  e e  D] Z e e ^ q±  Z g  e j D] Z e d f ^ qΤ g  e j D] Z e d f ^ qσ g  e j D] Z e d f ^ qZ d d g Z g  e D]( \ Z Z e D] Z e e e f ^ qOq?Z e j j d e  d    Z d   Z d   Z  d S(   i    (   t   print_functiont   divisiont   absolute_importN(   t   partial(   t   compute(   t	   filetexts(   t   compression(   t	   read_textt	   schedulert   syncs   {"amount": 100, "name": "Alice"}
{"amount": 200, "name": "Bob"}
{"amount": 300, "name": "Charlie"}
{"amount": 400, "name": "Dennis"}
s   .test.accounts.1.jsons   {"amount": 500, "name": "Alice"}
{"amount": 600, "name": "Bob"}
{"amount": 700, "name": "Charlie"}
{"amount": 800, "name": "Dennis"}
s   .test.accounts.2.jsont    s   10 Bt   asciis   utf-8s   fmt,bs,encodingc         ` s:  t  j |    t    f d   t j   D  } t | d d π t d d |  d | d  } t |  \ } d j |  t	 k s t
  t t t  d |  d | d  } t |  \ } d j |  t	 k sΫ t
  t d d |  d | d  d	 t } t |   } d j d
   | D  t	 k s0t
  Wd  QXd  S(   Nc         3` s0   |  ]& \ } } |   | j     f Vq d  S(   N(   t   encode(   t   .0t   kt   v(   t   compresst   encoding(    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pys	   <genexpr>%   s    t   modet   bs   .test.accounts.*.jsonR   t	   blocksizeR   R
   t
   collectionc         s` s"   |  ] } | D] } | Vq q d  S(   N(    (   R   t   blockt   line(    (    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pys	   <genexpr>4   s    (   R   R   t   dictt   filest   itemsR   R   R   t   joint   expectedt   AssertionErrort   sortedt   False(   t   fmtt   bsR   t   files2R   t   Lt   blocks(    (   R   R   s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pyt   test_read_text"   s    %		c       	   C` s   d   t  d  D }  t |   n t d d d } t | j d d d  } | d k sh t d	   | j   j   d k s t d
   Wd  QXd  S(   Nc         S` s"   i  |  ] } d  d j  |   q S(   s   line from {:02}s	   {:02}.txt(   t   format(   R   t   n(    (    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pys
   <dictcomp>8   s   	 i   s   *.txtt   files_per_partitioni
   id   t   npartitionsi   s-   10 files should be grouped into one partitions   All 20 lines should be read(   t   rangeR   R   t   lent   takeR   t   countR   (   t   files3R   t   l(    (    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pyt   test_files_per_partition7   s    c          C` s   t  i d d 6d d s t j t   t d d d j   Wd  QXt d d d d d }  |  j d	 d
  }  |  d d g k s t  Wd  QXd  S(   Ns
   Josι
Alices	   .test.fooR   R   R   R   t   errorst   ignoreR   R	   s   Jos
t   Alice(   R   t   pytestt   raisest   UnicodeDecodeErrorR   R   R   (   t   result(    (    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pyt   test_errorsB   s    (!   t
   __future__R    R   R   R4   t   toolzR   t   daskR   t
   dask.utilsR   t
   dask.bytesR   t   dask.bag.textR   R   R   R   R   R   R    t   Nonet   seekable_filest   fmt_bst	   encodingsR!   R   t
   fmt_bs_enct   markt   parametrizeR%   R0   R8   (    (    (    s7   lib/python2.7/site-packages/dask/bag/tests/test_text.pyt   <module>   s$   

,?#"	