def test_hotspot_location_intersecting_radar_lines(self):
        """Verifies that the hotspot_location function behaves correctly
        for intersecting radar lines.
        """
        #               ^
        #             / |
        #           /   |
        #         /     |
        #        A      B
        pt1 = (10.0, 10.0)
        dxdy1 = (0.7071, 0.7071)
        pt2 = (20.0, 10.0)
        dxdy2 = (0, 1)
        actual_hotspot_location = hotspot_location(pt1, dxdy1, pt2, dxdy2)
        expected_hotspot_location = (20.0, 20.0)

        self.assertAlmostEqual(expected_hotspot_location[0],
                               actual_hotspot_location[0],
                               msg="Expected hotspot location x-value (%.3f) "
                               "differs from actual hotspot location x-value (%.3f)"
                               % (expected_hotspot_location[0],
                                  actual_hotspot_location[0]),
                               delta=2e-3)

        self.assertAlmostEqual(expected_hotspot_location[1],
                               actual_hotspot_location[1],
                               msg="Expected hotspot location y-value (%.3f) "
                               "differs from actual hotspot location y-value (%.3f)"
                               % (expected_hotspot_location[1],
                                  actual_hotspot_location[1]),
                               delta=2e-3)
 def test_hotspot_location_radar_lines_with_same_direction(self):
     """Verifies that the hotspot_location function behaves correctly
     for radar lines that have the same direction.
     """
     # These lines should not intersect because they point in the same
     # direction.
     #                          ^
     #                        /
     #                      /
     #                    /
     #                   B
     #
     #                ^
     #              /
     #            /
     #          /
     #         A
     pt1 = (10.0, 10.0)
     pt2 = (20.0, 20.0)
     dxdy = (0.7071, 0.7071)
     actual_hotspot_location = hotspot_location(pt1, dxdy, pt2, dxdy)
     expected_hotspot_location = None
     self.assertEqual(actual_hotspot_location, expected_hotspot_location,
                      "Expected hotspot_location to return %s, but "
                      "returned %s instead. pt1 is %s and pt2 is %s, "
                      "both radar lines have the direction vector %s"
                      % (None,
                         actual_hotspot_location,
                         str(pt1),
                         str(pt2),
                         str(dxdy)))