47
47
},
48
48
"type" : "StringChoiceWidget" ,
49
49
},
50
+ "string_choice_default_list" : {
51
+ "name" : "string_choice" ,
52
+ "label" : "String Choice" ,
53
+ "details" : {
54
+ "labels" : {"val1" : "Val1" , "val2" : "Val2" , "val3" : "Val3" },
55
+ "default" : ["val1" ],
56
+ },
57
+ "type" : "StringChoiceWidget" ,
58
+ },
50
59
"geographic_extent_map" : {
51
60
"name" : "geographic_extent_map" ,
52
61
"label" : "Geographic Extent Map" ,
53
62
"details" : {"default" : [1 , 2 , 3 , 4 ]},
54
63
"type" : "GeographicExtentMapWidget" ,
55
64
},
65
+ "geographic_extent_map_default_dict" : {
66
+ "name" : "geographic_extent_map" ,
67
+ "label" : "Geographic Extent Map" ,
68
+ "details" : {"default" : {"n" : 1 , "w" : 2 , "s" : 3 , "e" : 4 }},
69
+ "type" : "GeographicExtentMapWidget" ,
70
+ },
56
71
"geographic_location" : {
57
72
"name" : "geographic_location" ,
58
73
"label" : "Geographic Location" ,
@@ -194,6 +209,11 @@ def test_translate_string_choice() -> None:
194
209
res_output = translators .translate_string_choice (test_input )
195
210
assert res_output == exp_ouput
196
211
212
+ test_input = TEST_INPUT_CDS_SCHEMAS ["string_choice_default_list" ]
213
+ exp_ouput = {"type" : "string" , "enum" : ["val1" , "val2" , "val3" ], "default" : "val1" }
214
+ res_output = translators .translate_string_choice (test_input )
215
+ assert res_output == exp_ouput
216
+
197
217
198
218
def test_translate_geographic_extent_map () -> None :
199
219
test_input = TEST_INPUT_CDS_SCHEMAS ["geographic_extent_map" ]
@@ -207,6 +227,17 @@ def test_translate_geographic_extent_map() -> None:
207
227
res_output = translators .translate_geographic_extent_map (test_input )
208
228
assert res_output == exp_ouput
209
229
230
+ test_input = TEST_INPUT_CDS_SCHEMAS ["geographic_extent_map_default_dict" ]
231
+ exp_ouput = {
232
+ "type" : "array" ,
233
+ "minItems" : 4 ,
234
+ "maxItems" : 4 ,
235
+ "items" : {"type" : "number" },
236
+ "default" : [1 , 2 , 3 , 4 ],
237
+ }
238
+ res_output = translators .translate_geographic_extent_map (test_input )
239
+ assert res_output == exp_ouput
240
+
210
241
211
242
def test_make_request_labels () -> None :
212
243
test_input_value_ids = ["1" , "1" , "1" , "1" ]
0 commit comments