From 4a371d6f87d4af8dcac187aff0964045914b1022 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 04:35:58 +0000 Subject: [PATCH] test: add edge case test for invalid num_tiles in CarouselService Added `test_create_carousel_tiles_invalid_num_tiles` to `tests/test_carousel_mock.py` to verify that `ValueError` is raised when `num_tiles` is outside the range [3, 5]. This improves test coverage for input validation in the carousel tile creation service. Co-authored-by: CaioIsCoding <106751132+CaioIsCoding@users.noreply.github.com> --- tests/test_carousel_mock.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_carousel_mock.py b/tests/test_carousel_mock.py index d115a2e..30e3d7c 100644 --- a/tests/test_carousel_mock.py +++ b/tests/test_carousel_mock.py @@ -92,5 +92,16 @@ def test_create_carousel_tiles_1_1(self, mock_makedirs): self.assertEqual(len(tile_paths), num_tiles) + def test_create_carousel_tiles_invalid_num_tiles(self): + # Test num_tiles < 3 + with self.assertRaises(ValueError) as cm: + CarouselService.create_carousel_tiles("dummy.jpg", "output", num_tiles=2) + self.assertEqual(str(cm.exception), "Number of tiles must be between 3 and 5.") + + # Test num_tiles > 5 + with self.assertRaises(ValueError) as cm: + CarouselService.create_carousel_tiles("dummy.jpg", "output", num_tiles=6) + self.assertEqual(str(cm.exception), "Number of tiles must be between 3 and 5.") + if __name__ == "__main__": unittest.main()