-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23857fa
commit e75796f
Showing
2 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (C) 2024 Nice Zombies | ||
"""JSON dump tests.""" | ||
from __future__ import annotations | ||
|
||
__all__: list[str] = [] | ||
|
||
from contextlib import redirect_stdout | ||
from io import StringIO | ||
from typing import TYPE_CHECKING | ||
|
||
# pylint: disable-next=W0611 | ||
from jsonyx.test import get_json # type: ignore # noqa: F401 | ||
|
||
if TYPE_CHECKING: | ||
from types import ModuleType | ||
|
||
|
||
def test_file(json: ModuleType) -> None: | ||
"""Test write to file.""" | ||
io: StringIO = StringIO() | ||
json.dump(0, io, end="") | ||
assert io.getvalue() == "0" | ||
|
||
|
||
def test_stdout(json: ModuleType) -> None: | ||
"""Test write to stdout.""" | ||
io: StringIO = StringIO() | ||
with redirect_stdout(io): | ||
json.dump(0, end="") | ||
assert io.getvalue() == "0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters