o
    cii                     @   s   d dl Zd dlZd dlmZ d dlmZ d dlmZ dd Z	dd Z
d	d
 Zejdg ddd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& ZdS )'    N)testing)expected_warnings)random_shapesc                  C   s"   t ddd\} }| jdksJ d S )N   r   
   )
max_shapes)r   r      r   shapeimage_ r   o/var/www/addictedbytheproject.nl/epg/venv/lib/python3.10/site-packages/skimage/draw/tests/test_random_shapes.py.test_generates_color_images_with_correct_shape	   s   r   c                  C   &   t dddd d\} }| jdksJ d S N)i  {   r	      )
min_shapesr   channel_axisr
   r   r   r   r   -test_generates_gray_images_with_correct_shape      
r   c                  C   r   r   r
   r   r   r   r   Etest_generates_gray_images_with_correct_shape_deprecated_multichannel   r   r   r   )Nr         c                 C   sP   d}d}t ||dd| d\}}| d u r|}n	tt|| |}|j|ks&J d S )Nr   @      r	   r   )num_channelsr   r   r   )r   tuplenpinsertr   )r   r   r    r   r   expected_shaper   r   r   %test_generated_shape_for_channel_axis   s   
r%   c                  C   s   t ddddd\} }t|dksJ |d \}}|dks J || |d d |d d |d d |d d f }|dk rF|dk  sHJ d| |d d |d d |d d |d d f< | dk sjJ d S )Nr   r   	rectangle*   r   r   rngr      r   lenallr   labelslabelbboxcropr   r   r   4test_generates_correct_bounding_boxes_for_rectangles1   s   44r3   c                  C   s   t ddddd\} }t|dksJ |d \}}|dks J || |d d |d d |d d |d d f }|dk rF|dk  sHJ d| |d d |d d |d d |d d f< | dk sjJ d S )Nr   r   triangler'   r(   r   r*   r   r,   anyr-   r.   r   r   r   3test_generates_correct_bounding_boxes_for_trianglesB   s   44r7   c                  C      t ddddddd\} }t|dksJ |d \}}|dks"J || |d d |d d |d d |d d f }|dk rH|dk  sJJ d| |d d |d d |d d |d d f< | dk slJ d S )	N+   ,   r   r   circler'   r   min_sizemax_sizer   r)   r   r*   r5   r.   r   r   r   1test_generates_correct_bounding_boxes_for_circlesR      
44r@   c                  C   r8   )	Nr9   r   r   ellipser'   r=   r   r*   r5   r.   r   r   r   2test_generates_correct_bounding_boxes_for_ellipsesd   rA   rC   c                   C   B   t t tdddddd W d    d S 1 sw   Y  d S )Nr   r   r   r<   r   r>   r?   r   r   raises
ValueErrorr   r   r   r   r   /test_generate_circle_throws_when_size_too_smallv      "rJ   c                   C   rD   )NrE   r   rB   rF   rG   r   r   r   r   0test_generate_ellipse_throws_when_size_too_small{   rK   rL   c                   C   rD   )Nr   r   r4   rF   rG   r   r   r   r   1test_generate_triangle_throws_when_size_too_small   rK   rM   c                  C   s   t dddddd\} }t|dksJ |d \}}| |d d |d d |d d |d d f }t|dkrHt|dkrHt|dk sJJ d S )N)2   r   r   r&   rF   r   )r   r   r	   r*   )r   r,   r"   r   r6   )r   r/   r   r1   r2   r   r   r   &test_can_generate_one_by_one_rectangle   s   

42rO   c                   C   sx   t t tddd dd W d    n1 sw   Y  t t tdddd W d    d S 1 s5w   Y  d S )N)i  i  r   )r      )r   r   intensity_range)r   r   ))r*   )r   rQ   rG   r   r   r   r   -test_throws_when_intensity_range_out_of_range   s   "rS   c                  C   sb   t dg tddddd\} }W d    n1 sw   Y  t|dks'J | dk s/J d S )	NzCould not fit)'  rT   r   rT   r<   )r   r>   r   r   r*   )r   r   r,   r-   r   r/   r   r   r   ?test_returns_empty_labels_and_white_image_when_cannot_fit_shape   s   rV   c                     sX   d} g  t dD ]}tdd| d\}} | qt fdd dd  D s*J d S )Nr'   r   r   )r   r)   c                 3   s    | ]	}| d  kV  qdS )r   Nr   ).0otherr/   r   r   	<genexpr>   s    z?test_random_shapes_is_reproducible_with_seed.<locals>.<genexpr>r   )ranger   appendr-   )random_seedr   r0   r   rY   r   ,test_random_shapes_is_reproducible_with_seed   s   &r^   c                  C   s8   t ddddd\} }t|dksJ | dk sJ d S )Nr   r	   ))r*   r*   r'   )r   rQ   r)   r   r*   r+   rU   r   r   r   3test_generates_white_image_when_intensity_range_255   s
   
r_   )numpyr"   pytestskimage._sharedr   skimage._shared._warningsr   skimage.drawr   r   r   r   markparametrizer%   r3   r7   r@   rC   rJ   rL   rM   rO   rS   rV   r^   r_   r   r   r   r   <module>   s,    
	
	