
    &Vf6                     D    d dl Z ddlmZ d	dZd Z G d de          ZdS )
    N   )TestCase   c                 B    | j                                         |z  dk    S )Nr   )id
get_offset)datasetoffsets     [/var/www/html/software/conda/lib/python3.11/site-packages/h5py/tests/test_file_alignment.py
is_alignedr      s     :  ""V+q00    c                     d| dS )Ndata03 )is    r   dataset_namer   
   s    !===r   c                   $    e Zd ZdZd Zd Zd ZdS )TestFileAlignmentzn
        Ensure that setting the file alignment has the desired effect
        in the internal structure.
    c                 H   |                                  }d}t          j        |d          5 }t          d          D ]=}|                    t          |          |d          }||d<   t          |          s n>t          d          	 d d d            d S # 1 swxY w Y   d S )Niq  w  uint8dtype.z(Data was all found to be aligned to 4096mktemph5pyFilerangecreate_datasetr   r   RuntimeError)selffnameshapeh5filer   r	   s         r   test_no_alignment_setz'TestFileAlignment.test_no_alignment_set   s   
 Yuc"" 	Of 4[[ 
O 
O // OOU' 0 ; ;  !!'** E ##MNNN 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	Os   ABBBc                 F   d}d}dD ]}|                                  }t          j        |d||          5 }t          d          D ]B}|                    t          |          |d          }|dz  |d	<   t          ||
          sJ C	 d d d            n# 1 swxY w Y   d S )Nr   r   ))i	  )r   )i  r   alignment_thresholdalignment_intervalr   r      .r
   )r   r   r    r!   r"   r   r   r$   r+   r,   r&   r%   r'   r   r	   s           r   "test_alignment_set_above_thresholdz4TestFileAlignment.test_alignment_set_above_threshold.   s8    #!
 	J 	JE
 KKMME5#/B.@B B B JEK t J JA$33$Qg 4 ? ?G %&GGCL%g6HIIIIIIIJJ J J J J J J J J J J J J J J	J 	Js   ABB	B	c                 f   d}d}dD ]}|                                  }t          j        |d||          5 }t          d          D ]?}|                    t          |          |d          }||d<   t          ||	          s n@t          d
| d          	 d d d            n# 1 swxY w Y   d S )Nr   i   )r   )i  r   r*   r   r   .r.   z$Data was all found to be aligned to z. This is highly unlikely.r   r/   s           r   "test_alignment_set_below_thresholdz4TestFileAlignment.test_alignment_set_below_thresholdG   sh    #!
 	K 	KE KKMME5#/B.@B B B KEK t K KA$33$Qg 4 ? ?G $%GCL%g6HIII  'J-J J JK K K #K K K K K K K K K K K K K K K	K 	Ks   A#B%%B)	,B)	N)__name__
__module____qualname____doc__r(   r0   r2   r   r   r   r   r      sV         O O O6J J J2 K  K  K  K  Kr   r   )r   )r   commonr   r   r   r   r   r   r   <module>r8      s          1 1 1 1
  YK YK YK YK YK YK YK YK YK YKr   