def test_isPointExcluded_noRegions(self): """Test the isPointExcluded method when no regions are defined.""" mockLogger = mock.Mock() unit = ExcludeRegionState(mockLogger) self.assertFalse( unit.isPointExcluded(0, 0), "(0,0) should NOT be excluded when no regions are defined") self.assertFalse( unit.isPointExcluded(10, 10), "(10,10) should NOT be excluded when no regions are defined")
def test_isPointExcluded_oneRegion(self): """Test the isPointExcluded method when one region is defined.""" mockLogger = mock.Mock() unit = ExcludeRegionState(mockLogger) aRegion = RectangularRegion(x1=0, y1=0, x2=5, y2=5) unit.addRegion(aRegion) self.assertTrue(unit.isPointExcluded(0, 0), "(0,0) should be excluded (one region)") self.assertFalse(unit.isPointExcluded(10, 10), "(10,10) should NOT be excluded (one region)")
def test_isPointExcluded_exclusionDisabled(self): """Test the isPointExcluded method when exclusion is diabled.""" mockLogger = mock.Mock() unit = ExcludeRegionState(mockLogger) aRegion = RectangularRegion(x1=0, y1=0, x2=5, y2=5) unit.addRegion(aRegion) unit.disableExclusion("Disable for test") self.assertFalse(unit.isPointExcluded(0, 0), "(0,0) should NOT be excluded (exclusion disabled)") self.assertFalse( unit.isPointExcluded(10, 10), "(10,10) should NOT be excluded (exclusion disabled)")
def test_isPointExcluded_multipleRegions(self): """Test the isPointExcluded method when multiple regions are defined.""" mockLogger = mock.Mock() unit = ExcludeRegionState(mockLogger) aRegion = RectangularRegion(x1=0, y1=0, x2=5, y2=5) anotherRegion = CircularRegion(cx=20, cy=20, r=10) unit.addRegion(aRegion) unit.addRegion(anotherRegion) self.assertTrue(unit.isPointExcluded(0, 0), "(0,0) should be excluded (mult regions)") self.assertFalse(unit.isPointExcluded(10, 10), "(10,10) should NOT be excluded (mult regions)") self.assertTrue(unit.isPointExcluded(20, 20), "(20,20) should be excluded (mult regions)") self.assertFalse(unit.isPointExcluded(30, 10), "(30,10) should NOT be excluded (mult regions)")