From 81a0a5933e8c723faa7910266d76b9e22ee6f761 Mon Sep 17 00:00:00 2001 From: Yusuke Matsubara Date: Tue, 25 Feb 2025 01:39:12 +0200 Subject: [PATCH] Add more logging tests Signed-off-by: Yusuke Matsubara --- tests/unit/test_compose_run_log_format.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/test_compose_run_log_format.py b/tests/unit/test_compose_run_log_format.py index e63f5be..64871a7 100644 --- a/tests/unit/test_compose_run_log_format.py +++ b/tests/unit/test_compose_run_log_format.py @@ -28,6 +28,16 @@ class TestComposeRunLogFormat(unittest.IsolatedAsyncioTestCase): await self.p._format_stream(reader, self.buffer, 'LL:') self.assertEqual(self.buffer.getvalue(), 'LL: hello, world\n') + async def test_empty(self): + reader = DummyReader([]) + await self.p._format_stream(reader, self.buffer, 'LL:') + self.assertEqual(self.buffer.getvalue(), '') + + async def test_empty2(self): + reader = DummyReader([b'']) + await self.p._format_stream(reader, self.buffer, 'LL:') + self.assertEqual(self.buffer.getvalue(), '') + async def test_empty_line(self): reader = DummyReader([b'\n']) await self.p._format_stream(reader, self.buffer, 'LL:')