@@ -29,6 +29,78 @@ def validate_iso_format(date_string: str):
29
29
assert parsed_t .second is not None
30
30
31
31
32
+ @pytest .mark .parametrize (
33
+ "media_type, data_type_class" ,
34
+ [
35
+ (MediaType .Audio , GenericDataRowData ),
36
+ (MediaType .Html , GenericDataRowData ),
37
+ (MediaType .Image , GenericDataRowData ),
38
+ (MediaType .Text , GenericDataRowData ),
39
+ (MediaType .Video , GenericDataRowData ),
40
+ (MediaType .Conversational , GenericDataRowData ),
41
+ (MediaType .Document , GenericDataRowData ),
42
+ (MediaType .LLMPromptResponseCreation , GenericDataRowData ),
43
+ (MediaType .LLMPromptCreation , GenericDataRowData ),
44
+ (OntologyKind .ResponseCreation , GenericDataRowData ),
45
+ (OntologyKind .ModelEvaluation , GenericDataRowData ),
46
+ ],
47
+ )
48
+ def test_generic_data_row_type_by_data_row_id (
49
+ media_type ,
50
+ data_type_class ,
51
+ annotations_by_media_type ,
52
+ hardcoded_datarow_id ,
53
+ ):
54
+ annotations_ndjson = annotations_by_media_type [media_type ]
55
+ annotations_ndjson = [annotation [0 ] for annotation in annotations_ndjson ]
56
+
57
+ label = list (NDJsonConverter .deserialize (annotations_ndjson ))[0 ]
58
+
59
+ data_label = Label (
60
+ data = data_type_class (uid = hardcoded_datarow_id ()),
61
+ annotations = label .annotations ,
62
+ )
63
+
64
+ assert data_label .data .uid == label .data .uid
65
+ assert label .annotations == data_label .annotations
66
+
67
+
68
+ @pytest .mark .parametrize (
69
+ "media_type, data_type_class" ,
70
+ [
71
+ (MediaType .Audio , GenericDataRowData ),
72
+ (MediaType .Html , GenericDataRowData ),
73
+ (MediaType .Image , GenericDataRowData ),
74
+ (MediaType .Text , GenericDataRowData ),
75
+ (MediaType .Video , GenericDataRowData ),
76
+ (MediaType .Conversational , GenericDataRowData ),
77
+ (MediaType .Document , GenericDataRowData ),
78
+ # (MediaType.LLMPromptResponseCreation, GenericDataRowData),
79
+ # (MediaType.LLMPromptCreation, GenericDataRowData),
80
+ (OntologyKind .ResponseCreation , GenericDataRowData ),
81
+ (OntologyKind .ModelEvaluation , GenericDataRowData ),
82
+ ],
83
+ )
84
+ def test_generic_data_row_type_by_global_key (
85
+ media_type ,
86
+ data_type_class ,
87
+ annotations_by_media_type ,
88
+ hardcoded_global_key ,
89
+ ):
90
+ annotations_ndjson = annotations_by_media_type [media_type ]
91
+ annotations_ndjson = [annotation [0 ] for annotation in annotations_ndjson ]
92
+
93
+ label = list (NDJsonConverter .deserialize (annotations_ndjson ))[0 ]
94
+
95
+ data_label = Label (
96
+ data = data_type_class (global_key = hardcoded_global_key ()),
97
+ annotations = label .annotations ,
98
+ )
99
+
100
+ assert data_label .data .global_key == label .data .global_key
101
+ assert label .annotations == data_label .annotations
102
+
103
+
32
104
@pytest .mark .parametrize (
33
105
"configured_project, media_type" ,
34
106
[
0 commit comments