Skip to content

Commit

Permalink
Merge pull request #85 from UBC-MDS/fix-test-cov
Browse files Browse the repository at this point in the history
Switch back to direct calling of input checker to ensure full code coverage
  • Loading branch information
Arc-Celt authored Jan 18, 2025
2 parents 057fe09 + 6f01557 commit e482bcb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/sharpedge/frame_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def frame_image(img, h_border=20, w_border=20, inside=False, color=0):
>>> framed_img_rgb = frame_image(img_rgb, h_border=20, w_border=20, inside=False, color=(255, 0, 0))
"""
# Input validation
if not Utility._input_checker(img):
return
Utility._input_checker(img)

# Warning: when image size is below 3 x 3
if img.shape[0] < 3 or img.shape[1] < 3:
Expand Down
3 changes: 1 addition & 2 deletions src/sharpedge/modulate_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def modulate_image(img, mode='as-is', ch_swap=None, ch_extract=None):
"""
# Input validation
if not Utility._input_checker(img):
return
Utility._input_checker(img)

# Validate 'mode' input
if mode not in ['as-is', 'gray', 'rgb']:
Expand Down
3 changes: 1 addition & 2 deletions src/sharpedge/pca_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def pca_compression(img, preservation_rate=0.9):
>>> compressed_img = pca_compression(img)
"""
# Validate Input
if not Utility._input_checker(img):
return
Utility._input_checker(img)
if img.ndim != 2:
raise ValueError("Input image must be a 2D array.")
if not isinstance(preservation_rate, (int, float)):
Expand Down
3 changes: 1 addition & 2 deletions src/sharpedge/pooling_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def pooling_image(img, window_size, pooling_method=np.mean):
>>> pooled_img = pooling_image(img_rgb, window_size=20, pooling_method=np.max)
"""
# Input validation
if not Utility._input_checker(img):
return
Utility._input_checker(img)

if not isinstance(window_size, int):
raise TypeError("window_size must be an integer.")
Expand Down
3 changes: 1 addition & 2 deletions src/sharpedge/reposition_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def reposition_image(img, flip='none', rotate='up', shift_x=0, shift_y=0):
>>> repositioned_img = reposition_image(img_rgb, flip='both', rotate='down', shift_x=-5, shift_y=10)
"""
# Input validation
if not Utility._input_checker(img):
return
Utility._input_checker(img)

# Validate flip
valid_flips = ["none", "horizontal", "vertical", "both"]
Expand Down

0 comments on commit e482bcb

Please sign in to comment.