Skip to content

Commit 75feba3

Browse files
committed
Fix reference tests
1 parent 2073e47 commit 75feba3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

fsspec/implementations/tests/test_reference.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515

1616
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+
1721
refs = {
1822
"a": b"data",
1923
"b": (realfile, 0, 5),
@@ -28,12 +32,16 @@ def test_simple(server): # noqa: F811
2832
assert fs.cat("b") == data[:5]
2933
assert fs.cat("c") == data[1 : 1 + 5]
3034
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")
3236
with fs.open("d", "rt") as f:
3337
assert f.read(2) == "he"
3438

3539

3640
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+
3745
in_data = {
3846
"version": 1,
3947
"refs": {
@@ -51,7 +59,7 @@ def test_simple_ver1(server): # noqa: F811
5159
assert fs.cat("b") == data[:5]
5260
assert fs.cat("c") == data[1 : 1 + 5]
5361
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")
5563
with fs.open("d", "rt") as f:
5664
assert f.read(2) == "he"
5765

0 commit comments

Comments
 (0)