@@ -229,6 +229,8 @@ def test_defaults(server): # noqa: F811
229229
230230def test_spec1_expand ():
231231 pytest .importorskip ("jinja2" )
232+ from fsspec .implementations .reference import json as json_impl
233+
232234 in_data = {
233235 "version" : 1 ,
234236 "templates" : {"u" : "server.domain/path" , "f" : "{{c}}" },
@@ -252,6 +254,7 @@ def test_spec1_expand():
252254 "key2" : ["http://{{u}}" , 10000 , 100 ],
253255 "key3" : ["http://{{f(c='text')}}" , 10000 , 100 ],
254256 "key4" : ["http://target_url" ],
257+ "key5" : {"key" : "value" },
255258 },
256259 }
257260 fs = fsspec .filesystem (
@@ -263,6 +266,7 @@ def test_spec1_expand():
263266 "key2" : ["http://server.domain/path" , 10000 , 100 ],
264267 "key3" : ["http://text" , 10000 , 100 ],
265268 "key4" : ["http://target_url" ],
269+ "key5" : json_impl .dumps (in_data ["refs" ]["key5" ]),
266270 "gen_key0" : ["http://server.domain/path_0" , 1000 , 1000 ],
267271 "gen_key1" : ["http://server.domain/path_1" , 2000 , 1000 ],
268272 "gen_key2" : ["http://server.domain/path_2" , 3000 , 1000 ],
@@ -275,13 +279,16 @@ def test_spec1_expand():
275279
276280def test_spec1_expand_simple ():
277281 pytest .importorskip ("jinja2" )
282+ from fsspec .implementations .reference import json as json_impl
283+
278284 in_data = {
279285 "version" : 1 ,
280286 "templates" : {"u" : "server.domain/path" },
281287 "refs" : {
282288 "key0" : "base64:ZGF0YQ==" ,
283289 "key2" : ["http://{{u}}" , 10000 , 100 ],
284290 "key4" : ["http://target_url" ],
291+ "key5" : {"key" : "value" },
285292 },
286293 }
287294 fs = fsspec .filesystem ("reference" , fo = in_data , target_protocol = "http" )
@@ -294,6 +301,7 @@ def test_spec1_expand_simple():
294301 )
295302 assert fs .references ["key2" ] == ["http://not.org/p" , 10000 , 100 ]
296303 assert fs .cat ("key0" ) == b"data"
304+ assert fs .cat ("key5" ) == json_impl .dumps (in_data ["refs" ]["key5" ]).encode ("utf-8" )
297305
298306
299307def test_spec1_gen_variants ():
0 commit comments