def test_detect_returns_an_empty_matrix_with_nothing_in_range(self):
        test = np.ones((100, 100, 3), dtype='uint8') * 255
        expected = np.zeros((100, 100, 1), dtype='uint8')

        laser_detector = LaserDetector((128, 128, 128), (129, 129, 129))
        result = laser_detector.detect(test)

        self.assertTrue((expected == result).all())
    def test_detect_returns_matrix_of_matched_points_if_in_range(self):
        test = np.ones((10, 10, 3), dtype='uint8') * 129
        expected = np.ones((10, 10, 1), dtype='uint8') * 255

        laser_detector = LaserDetector((128, 128, 128), (130, 130, 130))
        result = laser_detector.detect(test)

        self.assertTrue((expected == result).all(),
                        "{} != {}".format(expected, result))
        self.assertEquals(expected.dtype, result.dtype)
 def test_raises_exception_if_inverted_values(self):
     with self.assertRaises(Exception):
         LaserDetector((130, 128, 128), (129, 129, 129))
     with self.assertRaises(Exception):
         LaserDetector((128, 130, 128), (129, 129, 129))
     with self.assertRaises(Exception):
         LaserDetector((128, 128, 130), (129, 129, 129))
     with self.assertRaises(Exception):
         LaserDetector(
             (127, 127, 127),
             (126, 128, 128),
         )
     with self.assertRaises(Exception):
         LaserDetector(
             (127, 127, 127),
             (128, 126, 128),
         )
     with self.assertRaises(Exception):
         LaserDetector(
             (127, 127, 127),
             (128, 128, 126),
         )