def test_deleteRegion_found_middle(self):
        """Test the deleteRegion method when the region is neither first nor last in the list."""
        mockLogger = mock.Mock()
        unit = ExcludeRegionState(mockLogger)

        firstRegion = RectangularRegion(x1=10,
                                        y1=10,
                                        x2=20,
                                        y2=20,
                                        id="firstId")
        findRegion = RectangularRegion(x1=0, y1=0, x2=100, y2=100, id="findId")
        lastRegion = RectangularRegion(x1=20, y1=20, x2=30, y2=30, id="lastId")

        unit.addRegion(firstRegion)
        unit.addRegion(findRegion)
        unit.addRegion(lastRegion)

        self.assertTrue(
            unit.deleteRegion("findId"),
            "deleteRegion should return True when the region is found and removed (middle)"
        )
        self.assertEqual(
            unit.excludedRegions, [firstRegion, lastRegion],
            "The excluded regions should be updated by deleteRegion if the ID is found (middle)"
        )
    def test_deleteRegion_noRegions(self):
        """Test the deleteRegion method when no regions are defined."""
        mockLogger = mock.Mock()
        unit = ExcludeRegionState(mockLogger)

        self.assertFalse(
            unit.deleteRegion("notFound"),
            "deleteRegion should return False when the region is not found (no regions defined)"
        )
    def test_deleteRegion_notFound(self):
        """Test the deleteRegion method when the specified region is not found."""
        mockLogger = mock.Mock()
        unit = ExcludeRegionState(mockLogger)

        aRegion = RectangularRegion(x1=0, y1=0, x2=100, y2=100, id="anId")
        unit.addRegion(aRegion)

        self.assertFalse(
            unit.deleteRegion("notFound"),
            "deleteRegion should return False when the region is not found")
        self.assertEqual(
            unit.excludedRegions, [aRegion],
            "The excluded regions should not be modified by deleteRegion if the ID was not found"
        )
    def test_deleteRegion_found_single(self):
        """Test the deleteRegion method when the specified region is the only one defined."""
        mockLogger = mock.Mock()
        unit = ExcludeRegionState(mockLogger)

        findRegion = RectangularRegion(x1=0, y1=0, x2=100, y2=100, id="findId")
        unit.addRegion(findRegion)

        self.assertTrue(
            unit.deleteRegion("findId"),
            "deleteRegion should return True when the region is found and removed (single)"
        )
        self.assertEqual(
            unit.excludedRegions, [],
            "The excluded regions should be updated by deleteRegion if the ID is found (single)"
        )
    def test_deleteRegion_found_last(self):
        """Test the deleteRegion method when the specified region is last in the list."""
        mockLogger = mock.Mock()
        unit = ExcludeRegionState(mockLogger)

        findRegion = RectangularRegion(x1=0, y1=0, x2=100, y2=100, id="findId")
        otherRegion = RectangularRegion(x1=10,
                                        y1=10,
                                        x2=20,
                                        y2=20,
                                        id="otherId")

        unit.addRegion(otherRegion)
        unit.addRegion(findRegion)

        self.assertTrue(
            unit.deleteRegion("findId"),
            "deleteRegion should return True when the region is found and removed (last)"
        )
        self.assertEqual(
            unit.excludedRegions, [otherRegion],
            "The excluded regions should be updated by deleteRegion if the ID is found (last)"
        )