|
45 | 45 | ), |
46 | 46 | ], |
47 | 47 | ) |
48 | | -def test_worldclock(monkeypatch, capsys, args, expected): |
| 48 | +def test_worldclock(monkeypatch, args, expected): |
49 | 49 | mock_env = { |
50 | 50 | "TIMEZONE_LIST": '["Europe/Berlin", "Australia/Sydney", "America/Los_Angeles"]' |
51 | 51 | } |
52 | 52 | monkeypatch.setattr(os, "environ", mock_env) |
53 | | - worldclock.convert_time(*args) |
54 | | - captured = capsys.readouterr() |
55 | | - assert captured.out == expected |
56 | | - |
| 53 | + result = worldclock.convert_time(*args) |
| 54 | + output = "\n".join( |
| 55 | + f"{zone:25} {time}" for zone, time in result |
| 56 | + ) + "\n" |
| 57 | + assert output == expected |
57 | 58 |
|
58 | 59 | def test_bad_timezone_json(monkeypatch, capsys): |
59 | 60 | mock_env = {"TIMEZONE_LIST": '["CET" "Australia/Sydney", "America/Los_Angeles"]'} |
@@ -123,11 +124,13 @@ def test_bad_timezone_entered(monkeypatch, capsys): |
123 | 124 | ), |
124 | 125 | ], |
125 | 126 | ) |
126 | | -def test_worldclock_with_date_offset(monkeypatch, capsys, args, expected): |
| 127 | +def test_worldclock_with_date_offset(monkeypatch, args, expected): |
127 | 128 | mock_env = { |
128 | 129 | "TIMEZONE_LIST": '["Europe/Berlin", "Australia/Sydney", "America/Los_Angeles"]' |
129 | 130 | } |
130 | 131 | monkeypatch.setattr(os, "environ", mock_env) |
131 | | - worldclock.convert_time(*args) |
132 | | - captured = capsys.readouterr() |
133 | | - assert captured.out == expected |
| 132 | + result = worldclock.convert_time(*args) |
| 133 | + output = "\n".join( |
| 134 | + f"{zone:25} {time}" for zone, time in result |
| 135 | + ) + "\n" |
| 136 | + assert output == expected |
0 commit comments