File size: 656 Bytes
8c3e275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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