MCPcopy
hub / github.com/treeverse/dvc / test_write_json

Function test_write_json

tests/unit/ui/test_console.py:45–53  ·  view source on GitHub ↗

Test that ui.write_json works.

(capsys, mocker, isatty, expected_output)

Source from the content-addressed store, hash-verified

43 ],
44)
45def test_write_json(capsys, mocker, isatty, expected_output):
46 """Test that ui.write_json works."""
47
48 console = Console(enable=True)
49 mocker.patch.object(console, "isatty", return_value=isatty)
50 message = {"hello": "world", "date": datetime.datetime(1970, 1, 1)} # noqa: DTZ001
51 console.write_json(message, default=str)
52 captured = capsys.readouterr()
53 assert captured.out == expected_output
54
55
56def test_capsys_works(capsys):

Callers

nothing calls this directly

Calls 2

write_jsonMethod · 0.95
ConsoleClass · 0.90

Tested by

no test coverage detected