Spaces:
Build error
Build error
| # SPDX-FileCopyrightText: 2026 Team Centurions | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| import numpy as np | |
| from pageparse.preprocess import preprocess | |
| def test_preprocess_grayscale(): | |
| img = np.random.randint(0, 256, (100, 200, 3), dtype=np.uint8) | |
| result = preprocess(img) | |
| assert result.ndim == 2 | |
| assert result.dtype == np.uint8 | |
| def test_preprocess_already_gray(): | |
| img = np.random.randint(0, 256, (100, 200), dtype=np.uint8) | |
| result = preprocess(img) | |
| assert result.shape == (100, 200) | |
| def test_preprocess_empty(): | |
| img = np.zeros((50, 50), dtype=np.uint8) | |
| result = preprocess(img) | |
| assert result is not None | |