o
    ;Dit	                     @   st   d dl Zd dlZd dlmZ d dlmZmZmZm	Z	m
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)partial)
randomseedrandomtableRandomTable
dummytable
DummyTablec                  C   s@   t  } td t  }t| tsJ | dksJ | |ksJ dS )zJ
    Ensure that randomseed provides a non-empty string that changes.
        N)r   timesleep
isinstancestr)seed_1seed_2 r   S/var/www/Datamplify/venv/lib/python3.10/site-packages/petl/test/util/test_random.pytest_randomseed   s   
r   c                  C   s>   d\} }t | |}t|d | ksJ t||d ksJ dS )z]
    Ensure that randomtable provides a table with the right number of rows and columns.
    )   
   r   r   N)r   lencolumnsrowstabler   r   r   test_randomtable   s   
r   c                  C   s@   d\} }t | |d}t|d | ksJ t||d ksJ dS )z]
    Ensure that RandomTable provides a table with the right number of rows and columns.
    )   <   )numfldsnumrowsr   r   N)r   r   r   r   r   r   test_randomtable_class    s   r   c                  C   sx   dt tjddfdt tjg dfdt tjg dfdtjff} d	}t|| d
}|d dks0J t||d ks:J dS )z
    Ensure that dummytable provides a table with the right number of rows
    and that it accepts and uses custom column names provided.
    countr   d   pet)dogcatcowcolor)yelloworangebrownvalue#   )r   fields)r    r"   r&   r*   r   N)r   pyrandomrandintchoicerandomr   r   r   r   r   r   test_dummytable_custom_fields+   s   r1   c                  C   s:   d} t | d}t|d dksJ t|| d ksJ dS )z~
    Ensure that dummytable provides a table with the right number of rows
    and columns when not provided with a seed.
    r+   r   r   r   r   Nr   r   r   r   r   r   r   test_dummytable_no_seed=   s   
r5   c                  C   s@   d} d}t | |d}t|d dksJ t|| d ksJ dS )z
    Ensure that dummytable provides a table with the right number of rows
    and columns when provided with an integer as a seed.
    r+   *   )r   seedr   r   r   Nr3   )r   r7   r   r   r   r   test_dummytable_int_seedI   s
   r8   c                  C   s&   d} t | d}t|| d ksJ dS )z`
    Ensure that DummyTable provides a table with the right number of rows
    and columns.
    F   r2   r   N)r   r   r4   r   r   r   test_dummytable_classU   s   
r:   )r0   r-   r
   	functoolsr   petl.util.randomr   r   r   r   r   r   r   r   r1   r5   r8   r:   r   r   r   r   <module>   s    