o
    Jf	                     @   sz   d dl Z d dlZd dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
mZ d dlmZmZ dd ZG d	d
 d
ejZdS )    N)partial)islice)ShapelyDeprecationWarning)MultiPolygonPoint)cascaded_unionunary_unionc                 #   s<     fdd}d}|dkr||V  |d7 }|dksdS dS )z4Returns an iterator over an infinite Halton sequencec                    sD   d}d  }| }|dkr |||   7 }|  }|  }|dks|S )Ng        g      ?r    )indexresultfibaser	   k/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/shapely/tests/legacy/test_union.pyvalue   s   zhalton.<locals>.value   r   Nr	   )r   r   r   r	   r   r   halton   s   

r   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
UnionTestCasec                    sz   t tjdd  fddtdD }dd |D }tjtdd t|}W d    n1 s/w   Y  |jd	v s;J d S )
Ng      4g      4@c                    s   g | ]	}t     qS r	   )r   ).0r   rr	   r   
<listcomp>(       z5UnionTestCase.test_cascaded_union.<locals>.<listcomp>d   c                 S   s   g | ]}| d qS )g      @)buffer)r   pr	   r	   r   r   +   s    zis deprecated)match)Polygonr   )	r   randomuniformrangepytestwarnsr   r   	geom_type)selfpointsspotsur	   r   r   test_cascaded_union!   s   
z!UnionTestCase.test_cascaded_unionc                 C   s0   t tttdddtttddd| _d S )N      x      )ziplistr   r   coords)r%   r	   r	   r   setUp3   s   
zUnionTestCase.setUpc                 C   s>   dd | j D }t|}|jdksJ |jtdksJ d S )Nc                 S      g | ]	}t |d qS g?r   r   r   xyr	   r	   r   r   <   r   z2UnionTestCase.test_unary_union.<locals>.<listcomp>r   g1׋?)r0   r   r$   arear"   approx)r%   patchesr(   r	   r	   r   test_unary_union;   s   zUnionTestCase.test_unary_unionc                 C   sL   t dd | jD }t|jtdksJ t||gjtdks$J d S )Nc                 S   r2   r3   r4   r5   r	   r	   r   r   D   r   z8UnionTestCase.test_unary_union_multi.<locals>.<listcomp>g]H0׋?)r   r0   r   r7   r"   r8   )r%   r9   r	   r	   r   test_unary_union_multiA   s    z$UnionTestCase.test_unary_union_multiN)__name__
__module____qualname__r)   r1   r:   r;   r	   r	   r	   r   r       s
    r   )r   unittest	functoolsr   	itertoolsr   r"   shapely.errorsr   shapely.geometryr   r   shapely.opsr   r   r   TestCaser   r	   r	   r	   r   <module>   s    