|
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 |
| 53 | + result = worldclock.convert_time(*args) |
| 54 | + output = "\n".join(f"{zone:25} {time}" for zone, time in result) + "\n" |
| 55 | + assert output == expected |
56 | 56 |
|
57 | 57 |
|
58 | 58 | def test_bad_timezone_json(monkeypatch, capsys): |
@@ -123,11 +123,11 @@ def test_bad_timezone_entered(monkeypatch, capsys): |
123 | 123 | ), |
124 | 124 | ], |
125 | 125 | ) |
126 | | -def test_worldclock_with_date_offset(monkeypatch, capsys, args, expected): |
| 126 | +def test_worldclock_with_date_offset(monkeypatch, args, expected): |
127 | 127 | mock_env = { |
128 | 128 | "TIMEZONE_LIST": '["Europe/Berlin", "Australia/Sydney", "America/Los_Angeles"]' |
129 | 129 | } |
130 | 130 | monkeypatch.setattr(os, "environ", mock_env) |
131 | | - worldclock.convert_time(*args) |
132 | | - captured = capsys.readouterr() |
133 | | - assert captured.out == expected |
| 131 | + result = worldclock.convert_time(*args) |
| 132 | + output = "\n".join(f"{zone:25} {time}" for zone, time in result) + "\n" |
| 133 | + assert output == expected |
0 commit comments