
    	]j                     B    d dl mZ d dlmZ d dlmZmZ  G d de      Zy)    )TestCase)Project)
AnnotationTaskc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)AnnotationResultCountTestsc                     t         j                  j                         | _        t        j                  j                  | j                  ddi      | _        y )NtextzThis is task)projectdata)r   objectscreater   r   task)selfs    Z/root/env/lib/python3.12/site-packages/label_studio/tests/test_annotations_result_count.pysetUpz AnnotationResultCountTests.setUp   s:    --/LL''FNC['\	    c                     t         j                  j                  | j                  | j                  g       }| j                  |j                  d       y)z,Test that an empty result gives a count of 0r   r   resultr   Nr   r   r   r   r   assertEqualresult_countr   
annotations     r   "test_empty_result_gives_zero_countz=AnnotationResultCountTests.test_empty_result_gives_zero_count   s>    ''..DIIt||\^._
00!4r   c                     t         j                  j                  | j                  | j                  d      }| j                  |j                  d       y)z(Test that None result gives a count of 0Nr   r   r   r   s     r   !test_none_result_gives_zero_countz<AnnotationResultCountTests.test_none_result_gives_zero_count   s>    ''..DIIt||\`.a
00!4r   c           	          t         j                  j                  | j                  | j                  dddddddddg      }| j                  |j                  d       y	)
z%Test that only unique IDs are counted1test1idvalue2test2test3r      Nr   r   s     r   !test_unique_ids_counted_correctlyz<AnnotationResultCountTests.test_unique_ids_counted_correctly   s`    ''..LLW-W-W- / 

 	00!4r   c           	          t         j                  j                  | j                  | j                  dddddidddg      }| j                  |j                  d	       y
)z4Test that results without IDs are handled gracefullyr    r!   r"   r$   r&   3r'   r      Nr   r   s     r   test_missing_ids_skippedz3AnnotationResultCountTests.test_missing_ids_skipped"   s]    ''..LL1GW3Ec\cGde / 


 	00!4r   c                 &   t         j                  j                  | j                  | j                  dddg      }| j                  |j                  d       ddddddg|_        |j                          | j                  |j                  d       y	)
z/Test that updating the result updates the countr    r!   r"   r      r%   r&   r(   N)	r   r   r   r   r   r   r   r   saver   s     r   test_update_changes_countz4AnnotationResultCountTests.test_update_changes_count+   s    ''..DLLw:W9X / 

 	00!4$'':3QX<YZ
00!4r   N)	__name__
__module____qualname__r   r   r   r)   r-   r1    r   r   r   r      s!    ]5
5
55	5r   r   N)django.testr   projects.modelsr   tasks.modelsr   r   r   r5   r   r   <module>r9      s      # ).5 .5r   