Test that ui.write_json works.
(capsys, mocker, isatty, expected_output)
| 43 | ], |
| 44 | ) |
| 45 | def 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 | |
| 56 | def test_capsys_works(capsys): |
nothing calls this directly
no test coverage detected