Slide 14
Slide 14 text
ユニットテストの例
def resize_image(
img: np.ndarray,
width: int,
height: int,
) -> np.ndarray:
resize_img = cv2.resize(img, (width, height))
return resize_img
a = np.random.randint(0, 255, (2, 4, 3))
@pytest.mark.parametrize(
("img", "width", "height"),
[(a, 20, 30)],
)
def test_resize_image(
img: np.ndarray,
width: int,
height: int,
):
resize_img = resize_image(img, width, height)
assert resize_img.shape = (width, height, 3)
● 普通のユニットテストを書く。