Example #1
0
 def test_create_lilly_pad_returns_lilly_pad_type(self):
     # arrange
     fp = FrogPond(self.config)
     # act
     pad = fp._create_lilly_pad()
     # assert
     assert type(pad) == LillyPad
Example #2
0
 def test_is_overlapping_current_lilly_pads_returns_false_when_not_overlapping(self):
     # arrange
     fp = FrogPond(self.config)
     centre_pad = fp._create_centre_lilly_pad()
     pad1 = fp._create_lilly_pad()
     fp.lilly_pads = [centre_pad, pad1]
     overlapping_pad = Circle(Point(10000, 100000), 1)
     # act
     result = fp._is_overlapping_current_lilly_pads(overlapping_pad)
     # assert
     assert result is False
Example #3
0
 def test_is_overlapping_current_lilly_pads_returns_true_when_overlapping(self):
     # arrange
     fp = FrogPond(self.config)
     centre_pad = fp._create_centre_lilly_pad()
     pad1 = fp._create_lilly_pad()
     fp.lilly_pads = [centre_pad, pad1]
     overlapping_pad = Circle(pad1.circle.centre_point, 3)
     # act
     result = fp._is_overlapping_current_lilly_pads(overlapping_pad)
     # assert
     assert result is True
Example #4
0
 def test_choose_lilly_pad_position_returns_position_which_does_not_overlap_other_pads(self):
     # arrange
     fp = FrogPond(self.config)
     centre_pad = fp._create_centre_lilly_pad()
     pad1 = fp._create_lilly_pad()
     fp.lilly_pads = [centre_pad, pad1]
     pad2_radius = 3
     # act
     pad2_position = fp._choose_lilly_pad_position(pad2_radius)
     # assert
     pad2 = Circle(pad2_position, pad2_radius)
     assert not pad2.intersects_circle(pad1.circle) \
         and not pad2.intersects_circle(centre_pad.circle)