o
    rMf3                     @   s  d dl Z d dlZd dlmZ d dlmZ d dlmZmZmZ d dlm	Z	m
Z
mZ d dlmZmZmZ d dlmZ e   e dZee j i aG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZ G dd deZ!dd  Z"d!d" Z#d#d$ Z$d6d%d&Z%d'd( Z&d)d* Z'd+d, Z(d-d. Z)d/d0 Z*d1d2 Z+d3d4 Z,e-d5kre,  dS dS )7    N)datetime)Model)StringPropertyIntegerPropertyBooleanProperty)DateTimePropertyFloatPropertyReferenceProperty)PasswordPropertyListPropertyMapProperty)SDBPersistenceErrortest_dbc                   @   s$   e Zd Ze Ze Ze Ze	 Z
dS )	TestBasicN)__name__
__module____qualname__r   namer   sizer   foor   date r   r   U/var/www/html/analyze/labelStudio/lib/python3.10/site-packages/boto/sdb/db/test_db.pyr      s
    
r   c                   @      e Zd Ze Ze ZdS )	TestFloatN)r   r   r   r   r   r   valuer   r   r   r   r          
r   c                   @   s   e Zd ZedddZdS )TestRequiredTr   )requireddefaultN)r   r   r   r   reqr   r   r   r   r   "       r   c                   @   s   e Zd ZeeddZdS )TestReferencerefs)reference_classcollection_nameN)r   r   r   r	   r   refr   r   r   r   r"   &   r!   r"   c                   @      e Zd Ze ZdS )TestSubClassN)r   r   r   r   answerr   r   r   r   r(   *   s    
r(   c                   @   r'   )TestPasswordN)r   r   r   r
   passwordr   r   r   r   r*   .   s    
r*   c                   @      e Zd Ze ZeeZdS )TestListN)r   r   r   r   r   r   intnumsr   r   r   r   r-   1       r-   c                   @   r   )TestMapN)r   r   r   r   r   r   mapr   r   r   r   r1   6   r   r1   c                   @   r,   )TestListReferenceN)r   r   r   r   r   r   r   basicsr   r   r   r   r3   ;   r0   r3   c                   @   s    e Zd ZeddZeddZdS )TestAutoNowT)auto_now_add)auto_nowN)r   r   r   r   create_datemodified_dater   r   r   r   r5   @   s    
r5   c                   @   s   e Zd ZeddZdS )
TestUniqueT)uniqueN)r   r   r   r   r   r   r   r   r   r:   E   s    r:   c                  C   s   t  } d| _d| _d| _t | _td | 	  | t
d< td td t | j}|t
d< |j| jks:J t | jg}t|d	ksIJ |d
 j| jksSJ | j|jks[J | j|jkscJ | j|jkskJ | S )NsimpleiTsaving objecttest_basic_t   now try retrieving ittest_basic_tt   r   )r   r   r   r   r   nowr   logdebugput_objectstimesleep	get_by_ididlen)tttlr   r   r   
test_basicH   s(   



rP   c                  C   s   t  } d| _d| _td |   | td< td td t 	| j
}|td< |j
| j
ks2J |j| jks:J |j| jksBJ | S )Nzfloat objectgfffffX@r=   test_float_tr?   r@   test_float_tt)r   r   r   rD   rE   saverG   rH   rI   rJ   rK   rM   rN   r   r   r   
test_float`   s   


rU   c                  C   s   t  } | td< |   | S )Ntest_required_t)r   rG   rF   rM   r   r   r   test_requiredq   s   rX   c                 C   sh   | st  } t }| |_|  td t|j}|td< |jj| jks'J | j	D ]}t
| q*d S )N
   test_reference_tt)rP   r"   r&   rF   rH   rI   rJ   rK   rG   r#   rD   rE   )rM   rN   or   r   r   test_referencex   s   

r\   c                  C   s&   t  } | td< d| _d| _|   d S )Ntest_subclass_tz
a subclassi)r(   rG   r   r   rS   rW   r   r   r   test_subclass   s
   r^   c                  C   s^   t  } | td< d| _|   td t | j}|td< |jdks$J t|jdks-J d S )Ntest_password_tr   r?   test_password_tt)	r*   rG   r+   rS   rH   rI   rJ   rK   strrT   r   r   r   test_password   s   
rb   c                  C   sh   t  } | td< d| _g d| _|   t | j}|td< |j| jks%J |jD ]	}t|ts1J q(d S )Ntest_list_tza list of ints)rB            r?   test_list_tt)	r-   rG   r   r/   rF   rJ   rK   
isinstancer.   )rM   rN   nr   r   r   	test_list   s   

rj   c                  C   sj   t  } |   | td< t }d|_| g|_|  td |td< t|j	}|jd j	| j	ks3J d S )Ntest_list_ref_tr   r?   test_list_ref_ttr   )
r   rF   rG   r3   r   r4   rH   rI   rJ   rK   )rM   rN   tttr   r   r   test_list_reference   s   
rn   c                  C   sp   t  } dttt  }|| _|   | td< td t  }|td< ||_z|  J  ty7   Y d S w )Nr   test_unique_trY   test_unique_tt)	r:   ra   r.   rH   r   rF   rG   rI   r   )rM   r   rN   r   r   r   test_unique   s   
rq   c                  C   sH   t  } |   | td< td t | j}|j | j ks"J d S )Ntest_datetime_tr?   )	r5   rF   rG   rH   rI   rJ   rK   r8   	timetuplerT   r   r   r   test_datetime   s   
rt   c                  C   s   t d t } t d t  t d t|  t d t  t d t  t d t  t d t  t d t	  t d	 t
  d S )
NrP   rX   r\   r^   rb   rj   rn   rt   rq   )rD   inforP   rX   r\   r^   rb   rj   rn   rt   rq   )t1r   r   r   test   s$   









rw   __main__)N).loggingrH   r   boto.sdb.db.modelr   boto.sdb.db.propertyr   r   r   r   r   r	   r
   r   r   boto.exceptionr   basicConfig	getLoggerrD   setLevelDEBUGrG   r   r   r   r"   r(   r*   r-   r1   r3   r5   r:   rP   rU   rX   r\   r^   rb   rj   rn   rq   rt   rw   r   r   r   r   r   <module>   sJ    

	
