mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
![pre-commit-ci[bot]](/assets/img/avatar_default.png)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
26 lines
533 B
Python
26 lines
533 B
Python
"""Testing xonsh json hooks"""
|
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
from xonsh.jsonutils import serialize_xonsh_json
|
|
from xonsh.tools import EnvPath
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"inp",
|
|
[
|
|
42,
|
|
"yo",
|
|
["hello"],
|
|
{"x": 65},
|
|
EnvPath(["wakka", "jawaka"]),
|
|
["y", EnvPath(["wakka", "jawaka"])],
|
|
{"z": EnvPath(["wakka", "jawaka"])},
|
|
],
|
|
)
|
|
def test_serialize_xonsh_json_roundtrip(inp):
|
|
s = json.dumps(inp, default=serialize_xonsh_json)
|
|
obs = json.loads(s)
|
|
assert inp == obs
|