o
    ×Ëh.  ã                   @   sj   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m	Z	 d dl
mZ dd„ ZG dd	„ d	ejƒZdS )
é    N)Úpartial)Úislice)ÚMultiPolygonÚPoint)Ú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   úZ/var/www/html/scripts/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                    sL   t tjddƒ‰ ‡ fdd„tdƒD ƒ}dd„ |D ƒ}t|ƒ}|jdv s$J ‚d S )Ng      4Àg      4@c                    s   g | ]	}t ˆ ƒ ˆ ƒ ƒ‘qS r   )r   )Ú.0r   ©Úrr   r   Ú
<listcomp>%   ó    z:UnionTestCase.test_unary_union_partial.<locals>.<listcomp>éd   c                 S   s   g | ]}|  d ¡‘qS )g      @)Úbuffer)r   Úpr   r   r   r   (   s    )ÚPolygonr   )r   ÚrandomÚuniformÚranger   Ú	geom_type)ÚselfÚpointsÚspotsÚur   r   r   Útest_unary_union_partial    s
   z&UnionTestCase.test_unary_union_partialc                 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   ÚsetUp/   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   8   r   z2UnionTestCase.test_unary_union.<locals>.<listcomp>r   g…1×‹þæ?)r+   r   r   ÚareaÚpytestÚapprox)r    Úpatchesr#   r   r   r   Útest_unary_union7   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   r-   r.   r/   r0   r   r   r   r   @   r   z8UnionTestCase.test_unary_union_multi.<locals>.<listcomp>g]H0×‹þæ?)r   r+   r   r2   r3   r4   )r    r5   r   r   r   Útest_unary_union_multi=   s    z$UnionTestCase.test_unary_union_multiN)Ú__name__Ú
__module__Ú__qualname__r$   r,   r6   r7   r   r   r   r   r      s
    r   )r   ÚunittestÚ	functoolsr   Ú	itertoolsr   r3   Úshapely.geometryr   r   Úshapely.opsr   r   ÚTestCaser   r   r   r   r   Ú<module>   s    