a
    v=ic                     @   s:   d dl Z ddlmZ dddZdd ZG d	d
 d
eZdS )    N   )TestCase   c                 C   s   | j  | dkS )Nr   )idZ
get_offset)datasetoffset r   o/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/h5py/tests/test_file_alignment.py
is_aligned   s    r
   c                 C   s   d| dS )NdataZ03r   )ir   r   r	   dataset_name
   s    r   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TestFileAlignmentzn
        Ensure that setting the file alignment has the desired effect
        in the internal structure.
    c                 C   sz   |   }d}t|dN}tdD ],}|jt||dd}||d< t|s" qXq"tdW d    n1 sl0    Y  d S )Niq  w  uint8Zdtype.z(Data was all found to be aligned to 4096mktemph5pyFilerangecreate_datasetr   r
   RuntimeError)selffnameshapeh5filer   r   r   r   r	   test_no_alignment_set   s    
z'TestFileAlignment.test_no_alignment_setc              	   C   s   d}d}dD ]x}|   }tj|d||dJ}tdD ]0}|jt||dd}||d< t||d	s4J q4W d    q1 sz0    Y  q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   r   r   r	   "test_alignment_set_above_threshold.   s    
z4TestFileAlignment.test_alignment_set_above_thresholdc              	   C   s   d}d}dD ]}|   }tj|d||dZ}tdD ]0}|jt||dd}||d< t||d	s4 qvq4td
| dW d    q1 s0    Y  q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$   r   r   r	   "test_alignment_set_below_thresholdG   s*    
z4TestFileAlignment.test_alignment_set_below_thresholdN)__name__
__module____qualname____doc__r   r%   r&   r   r   r   r	   r      s   r   )r   )r   commonr   r
   r   r   r   r   r   r	   <module>   s   
