Handle non-str keys when storing json data (#73958)

This commit is contained in:
J. Nick Koston
2022-06-24 09:59:01 -05:00
committed by GitHub
parent b880a05e45
commit 1866a1e925
2 changed files with 17 additions and 2 deletions

View File

@@ -52,6 +52,14 @@ def test_save_and_load():
assert data == TEST_JSON_A
def test_save_and_load_int_keys():
"""Test saving and loading back stringifies the keys."""
fname = _path_for("test1")
save_json(fname, {1: "a", 2: "b"})
data = load_json(fname)
assert data == {"1": "a", "2": "b"}
def test_save_and_load_private():
"""Test we can load private files and that they are protected."""
fname = _path_for("test2")