From 7ef28a88c33c2a7d52e11eac5ad86f088419f8be Mon Sep 17 00:00:00 2001 From: Rongze Liu Date: Wed, 15 Jan 2025 22:55:27 -0800 Subject: [PATCH] test: use the try and except framework for the expected and edge cases. --- tests/test_utility.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_utility.py b/tests/test_utility.py index 41e768d..772b305 100644 --- a/tests/test_utility.py +++ b/tests/test_utility.py @@ -10,7 +10,10 @@ np.array([[[1, 2, 3], [4, 5, 6]]]) ]) def test_valid_image_format(valid_array): - assert Utility._input_checker(valid_array) + try: + Utility._input_checker(valid_array) + except Exception as e: + pytest.fail(f"Valid data raised an error: {e}") # Edge cases @@ -23,7 +26,10 @@ def test_valid_image_format(valid_array): np.array([[]]), ]) def test_edge_image_format(edge_array): - assert Utility._input_checker(edge_array) + try: + Utility._input_checker(edge_array) + except Exception as e: + pytest.fail(f"Edge data raised an error: {e}") # Erroneous Cases