@@ -229,6 +229,8 @@ def test_defaults(server): # noqa: F811
229
229
230
230
def test_spec1_expand ():
231
231
pytest .importorskip ("jinja2" )
232
+ from fsspec .implementations .reference import json as json_impl
233
+
232
234
in_data = {
233
235
"version" : 1 ,
234
236
"templates" : {"u" : "server.domain/path" , "f" : "{{c}}" },
@@ -252,6 +254,7 @@ def test_spec1_expand():
252
254
"key2" : ["http://{{u}}" , 10000 , 100 ],
253
255
"key3" : ["http://{{f(c='text')}}" , 10000 , 100 ],
254
256
"key4" : ["http://target_url" ],
257
+ "key5" : {"key" : "value" },
255
258
},
256
259
}
257
260
fs = fsspec .filesystem (
@@ -263,6 +266,7 @@ def test_spec1_expand():
263
266
"key2" : ["http://server.domain/path" , 10000 , 100 ],
264
267
"key3" : ["http://text" , 10000 , 100 ],
265
268
"key4" : ["http://target_url" ],
269
+ "key5" : json_impl .dumps (in_data ["refs" ]["key5" ]),
266
270
"gen_key0" : ["http://server.domain/path_0" , 1000 , 1000 ],
267
271
"gen_key1" : ["http://server.domain/path_1" , 2000 , 1000 ],
268
272
"gen_key2" : ["http://server.domain/path_2" , 3000 , 1000 ],
@@ -275,13 +279,16 @@ def test_spec1_expand():
275
279
276
280
def test_spec1_expand_simple ():
277
281
pytest .importorskip ("jinja2" )
282
+ from fsspec .implementations .reference import json as json_impl
283
+
278
284
in_data = {
279
285
"version" : 1 ,
280
286
"templates" : {"u" : "server.domain/path" },
281
287
"refs" : {
282
288
"key0" : "base64:ZGF0YQ==" ,
283
289
"key2" : ["http://{{u}}" , 10000 , 100 ],
284
290
"key4" : ["http://target_url" ],
291
+ "key5" : {"key" : "value" },
285
292
},
286
293
}
287
294
fs = fsspec .filesystem ("reference" , fo = in_data , target_protocol = "http" )
@@ -294,6 +301,7 @@ def test_spec1_expand_simple():
294
301
)
295
302
assert fs .references ["key2" ] == ["http://not.org/p" , 10000 , 100 ]
296
303
assert fs .cat ("key0" ) == b"data"
304
+ assert fs .cat ("key5" ) == json_impl .dumps (in_data ["refs" ]["key5" ]).encode ("utf-8" )
297
305
298
306
299
307
def test_spec1_gen_variants ():
0 commit comments