File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
fsspec/implementations/tests Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 14
14
15
15
16
16
def test_simple (server ): # noqa: F811
17
+ # The dictionary in refs may be dumped with a different separator
18
+ # depending on whether json or ujson is imported
19
+ from fsspec .implementations .reference import json as json_impl
20
+
17
21
refs = {
18
22
"a" : b"data" ,
19
23
"b" : (realfile , 0 , 5 ),
@@ -28,12 +32,16 @@ def test_simple(server): # noqa: F811
28
32
assert fs .cat ("b" ) == data [:5 ]
29
33
assert fs .cat ("c" ) == data [1 : 1 + 5 ]
30
34
assert fs .cat ("d" ) == b"hello"
31
- assert fs .cat ("e" ) == b'{"key": "value"}'
35
+ assert fs .cat ("e" ) == json_impl . dumps ( refs [ "e" ]). encode ( "utf-8" )
32
36
with fs .open ("d" , "rt" ) as f :
33
37
assert f .read (2 ) == "he"
34
38
35
39
36
40
def test_simple_ver1 (server ): # noqa: F811
41
+ # The dictionary in refs may be dumped with a different separator
42
+ # depending on whether json or ujson is imported
43
+ from fsspec .implementations .reference import json as json_impl
44
+
37
45
in_data = {
38
46
"version" : 1 ,
39
47
"refs" : {
@@ -51,7 +59,7 @@ def test_simple_ver1(server): # noqa: F811
51
59
assert fs .cat ("b" ) == data [:5 ]
52
60
assert fs .cat ("c" ) == data [1 : 1 + 5 ]
53
61
assert fs .cat ("d" ) == b"hello"
54
- assert fs .cat ("e" ) == b'{"key": "value"}'
62
+ assert fs .cat ("e" ) == json_impl . dumps ( in_data [ "refs" ][ "e" ]). encode ( "utf-8" )
55
63
with fs .open ("d" , "rt" ) as f :
56
64
assert f .read (2 ) == "he"
57
65
You can’t perform that action at this time.
0 commit comments