o
    2h6                     @   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   )id
get_offset)datasetoffset r	   Y/var/www/html/chatgem/venv/lib/python3.10/site-packages/h5py/tests/test_file_alignment.py
is_aligned   s   r   c                 C   s   d| dS )Ndata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   s|   |   }d}t|d(}tdD ]}|jt||dd}||d< t|s' nqtdW d    d S 1 s7w   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   r	   r	   r
   test_no_alignment_set   s   
"z'TestFileAlignment.test_no_alignment_setc              	   C   s   d}d}dD ]>}|   }tj|d||d'}tdD ]}|jt||dd}|d |d	< t||d
s4J qW d    n1 s?w   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 ]D}|   }tj|d||d-}tdD ]}|jt||dd}||d< t||d	s2 n	qtd
| dW d    n1 sEw   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   s4   
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
    
