Skip to content

Commit

Permalink
try to improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
KedoKudo committed Feb 16, 2024
1 parent 4d232f2 commit 750af05
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit/backend/corrections/test_beam_hardening.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ def fake_beam_hardening_image() -> np.ndarray:

def test_beam_hardening_correction(fake_beam_hardening_image):
"""Test beam hardening correction"""
# test with incorrect array dim
with pytest.raises(ValueError):
beam_hardening_correction(
arrays=np.array([0, 1, 2, 3]),
q=0.005,
n=20.0,
opt=True,
)
# test with single image
corrected_image = beam_hardening_correction(
arrays=fake_beam_hardening_image[0],
q=0.005,
n=20.0,
opt=True,
)
assert corrected_image.shape == (255, 255)
# test the correction
corrected_image = beam_hardening_correction(
arrays=fake_beam_hardening_image,
Expand Down

0 comments on commit 750af05

Please sign in to comment.