6
6
* 基本的にHTTP GETのテストのみ行うこと。PUT/POST/DELETEのテストがあると、間違えて修正してまうおそれあり。
7
7
8
8
"""
9
+ from __future__ import annotations
10
+
9
11
import configparser
10
12
import datetime
11
13
import os
12
14
import uuid
15
+ from typing import Any
13
16
14
17
import pytest
15
18
import requests
45
48
46
49
47
50
class TestAnnotation :
51
+ input_data_id : str
52
+
48
53
@classmethod
49
54
def setup_class (cls ):
50
55
cls .input_data_id = test_wrapper .get_first_input_data_id_in_task (project_id , task_id )
@@ -121,6 +126,8 @@ def test_get_annotation_specs_relation(self):
121
126
122
127
123
128
class TestComment :
129
+ task : dict [str , Any ]
130
+
124
131
@classmethod
125
132
def setup_class (cls ):
126
133
task , _ = api .get_task (project_id , task_id )
@@ -178,6 +185,8 @@ def teardown_class(cls):
178
185
179
186
180
187
class TestInputData :
188
+ input_data_id : str
189
+
181
190
@classmethod
182
191
def setup_class (cls ):
183
192
cls .input_data_id = test_wrapper .get_first_input_data_id_in_task (project_id , task_id )
@@ -320,6 +329,8 @@ def test_get_my_member_in_project(self):
320
329
321
330
322
331
class TestOrganization :
332
+ organization_name : str
333
+
323
334
@classmethod
324
335
def setup_class (cls ):
325
336
cls .organization_name = api .get_organization_of_project (project_id )[0 ]["organization_name" ]
@@ -335,6 +346,8 @@ def test_wrapper_get_all_projects_of_organization(self):
335
346
336
347
337
348
class TestOrganizationMember :
349
+ organization_name : str
350
+
338
351
@classmethod
339
352
def setup_class (cls ):
340
353
cls .organization_name = api .get_organization_of_project (project_id )[0 ]["organization_name" ]
@@ -504,6 +517,8 @@ def test_get_statistics_available_dates(self):
504
517
505
518
506
519
class Testsupplementary :
520
+ input_data_id : str
521
+
507
522
@classmethod
508
523
def setup_class (cls ):
509
524
cls .input_data_id = test_wrapper .get_first_input_data_id_in_task (project_id , task_id )
@@ -519,19 +534,17 @@ def test_supplementary(self):
519
534
)
520
535
521
536
supplementary_data_list = wrapper .get_supplementary_data_list_or_none (project_id , self .input_data_id )
537
+ assert supplementary_data_list is not None
522
538
assert len ([e for e in supplementary_data_list if e ["supplementary_data_id" ] == supplementary_data_id ]) == 1
523
539
524
540
api .delete_supplementary_data (project_id , self .input_data_id , supplementary_data_id )
525
- supplementary_data_list = api .get_supplementary_data_list (project_id , self .input_data_id )[0 ]
526
- assert len ([e for e in supplementary_data_list if e ["supplementary_data_id" ] == supplementary_data_id ]) == 0
527
-
528
- # def test_wrapper_get_supplementary_data_list_or_none(self):
529
- # # 2021/01/04時点では、存在しないinput_data_idを指定すると404 Errorは発生しないので、このテストは実施しない
530
- # supplementary_data_list = wrapper.get_supplementary_data_list_or_none(project_id, "not-exists")
531
- # assert supplementary_data_list is None
541
+ supplementary_data_list2 = api .get_supplementary_data_list (project_id , self .input_data_id )[0 ]
542
+ assert len ([e for e in supplementary_data_list2 if e ["supplementary_data_id" ] == supplementary_data_id ]) == 0
532
543
533
544
534
545
class TestTask :
546
+ input_data_id : str
547
+
535
548
@classmethod
536
549
def setup_class (cls ):
537
550
cls .input_data_id = test_wrapper .get_first_input_data_id_in_task (project_id , task_id )
@@ -579,8 +592,8 @@ def test_batch_update_tasks(self):
579
592
print (f"put_task: task_id={ task_id } " )
580
593
test_task_data = api .put_task (project_id , test_task_id , request_body = request_body )[0 ]
581
594
582
- request_body = [{"project_id" : project_id , "task_id" : test_task_id , "_type" : "Delete" }]
583
- content = api .batch_update_tasks (project_id , request_body = request_body )[0 ]
595
+ request_body2 = [{"project_id" : project_id , "task_id" : test_task_id , "_type" : "Delete" }]
596
+ content = api .batch_update_tasks (project_id , request_body = request_body2 )[0 ]
584
597
assert type (content ) == list
585
598
586
599
def test_patch_tasks_metadata (self ):
@@ -631,6 +644,9 @@ class TestGetObjOrNone:
631
644
wrapper.get_xxx_or_none メソッドの確認
632
645
"""
633
646
647
+ organization_name : str
648
+ input_data_id : str
649
+
634
650
@classmethod
635
651
def setup_class (cls ):
636
652
cls .organization_name = api .get_organization_of_project (project_id )[0 ]["organization_name" ]
@@ -674,23 +690,23 @@ def test_get_task_or_none(self):
674
690
675
691
assert wrapper .get_task_or_none ("not-exists" , task_id ) is None
676
692
677
- def test_get_task_histories_or_none (self ):
678
- assert type (wrapper .get_task_histories_or_none (project_id , task_id )) == list
679
-
680
- assert wrapper .get_task_histories_or_none (project_id , "not-exists" ) is None
681
-
682
- assert wrapper .get_task_histories_or_none ("not-exists" , task_id ) is None
683
-
684
693
def test_get_task_histories_or_none (self ):
685
694
actual = wrapper .get_editor_annotation_or_none (project_id , task_id , self .input_data_id )
695
+ assert actual is not None
686
696
assert actual ["task_id" ] == task_id
687
697
assert actual ["input_data_id" ] == self .input_data_id
688
698
689
699
assert wrapper .get_editor_annotation_or_none (project_id , task_id , "not-exists" ) is None
690
700
assert wrapper .get_editor_annotation_or_none (project_id , "not-exists" , "not-exists" ) is None
691
701
702
+ def test_get_supplementary_data_list_or_none (self ):
703
+ supplementary_data_list = wrapper .get_supplementary_data_list_or_none (project_id , "not-exists" )
704
+ assert supplementary_data_list is None
705
+
692
706
693
707
class TestProtectedMethod :
708
+ input_data_id : str
709
+
694
710
@classmethod
695
711
def setup_class (cls ):
696
712
cls .input_data_id = test_wrapper .get_first_input_data_id_in_task (project_id , task_id )
0 commit comments