def test_detect_lines_max_line_gap_negative(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, max_line_gap=-10) assert exc.value.message == "Max_line_gap must be greater than 0."
def test_delete_lines_good(self): lines = ld.detect_lines(self.test_image) r = ld.delete_lines(self.test_image, lines[0][0]) assert isinstance(r, np.ndarray)
def test_detect_lines_threshold_negative(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, threshold=-1) assert exc.value.message == "Threshold value must be greater than 0."
def test_detect_lines_min_line_length_negative(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, min_line_length=-10) assert exc.value.message == "Min_line_length must be greater than 0."
def test_detect_lines_aperture_size_negative(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, aperture_size=-1) assert exc.value.message == "Aperture_size value must be greater than 0."
def test_detect_lines_rho_negative(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, rho=-1) assert exc.value.message == "Rho value must be greater than 0."
def test_detect_lines_max_val_overflow_error(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, min_val=100, max_val=260) assert exc.value.message == "Max_val value must be between 0 and 255."
def test_detect_lines_min_val_over_max_val(self): r = ld.detect_lines(self.test_image, min_val=200, max_val=100) assert r is None
def test_detect_lines_max_val_negative_error(self): r = ld.detect_lines(self.test_image, min_val=200, max_val=-100) assert r is None
def test_detect_lines_min_val_negative_error(self): with pytest.raises(ValueError) as exc: ld.detect_lines(self.test_image, min_val=-200) assert exc.value.message == "Min_val value must be between 0 and 255."
def test_detect_lines_file_not_found(self): with pytest.raises(IOError) as exc: ld.detect_lines("fakePath") assert exc.value.message == "Input file not found."
def test_detect_lines_file_none(self): with pytest.raises(ValueError) as exc: ld.detect_lines(None) assert exc.value.message == "Input_file must be different than '' " \ "or None."
def test_detect_lines_good(self): r = ld.detect_lines(self.test_image) assert len(r) >= 0