We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a72b1ef commit 67156a5Copy full SHA for 67156a5
stanio/json.py
@@ -6,7 +6,7 @@
6
7
uj_version = tuple(map(int, json.__version__.split(".")))
8
if uj_version < (5, 5, 0):
9
- raise ImportError("ujson version too old")
+ raise ImportError("ujson version too old") # pragma: no cover
10
UJSON_AVAILABLE = True
11
except:
12
UJSON_AVAILABLE = False
test/test_json.py
@@ -167,19 +167,21 @@ def test_tuples(TMPDIR) -> None:
167
"b": [(1, [2, 3]), (4, [5, 6])],
168
"c": ((1, np.array([1, 2.0, 3])), (3, np.array([1, 2, 3]))),
169
"m": {"1": 1, "2": [2, 3]},
170
+ "np": np.array([(1, 2, 3)], dtype="i,i,i"),
171
}
172
dict_tuple_exp = {
173
"a": {"1": 1, "2": 2, "3": 3},
174
"b": [{"1": 1, "2": [2, 3]}, {"1": 4, "2": [5, 6]}],
175
"c": {"1": {"1": 1, "2": [1, 2.0, 3]}, "2": {"1": 3, "2": [1, 2, 3]}},
176
177
+ "np": [{"1": 1, "2": 2, "3": 3}],
178
179
file_tuple = os.path.join(TMPDIR, "tuple.json")
180
write_stan_json(file_tuple, dict_tuples)
181
compare_before_after(file_tuple, dict_tuples, dict_tuple_exp)
182
183
-def test_write_vs_dump(TMPDIR):
184
+def test_write_vs_dump(TMPDIR) -> None:
185
dict_list = {"a": [1.0, 2.0, 3.0]}
186
file_write = os.path.join(TMPDIR, "write.json")
187
write_stan_json(file_write, dict_list)
0 commit comments