2023-09-15 00:35:48 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
from onnx_web.chain.reduce_thumbnail import ReduceThumbnailStage
|
2023-11-19 03:35:00 +00:00
|
|
|
from onnx_web.chain.result import StageResult
|
2023-09-15 00:35:48 +00:00
|
|
|
from onnx_web.params import HighresParams, Size, UpscaleParams
|
|
|
|
|
|
|
|
|
|
|
|
class ReduceThumbnailStageTests(unittest.TestCase):
|
|
|
|
def test_empty(self):
|
|
|
|
stage_source = Image.new("RGB", (64, 64))
|
|
|
|
stage = ReduceThumbnailStage()
|
2023-11-19 03:35:00 +00:00
|
|
|
sources = StageResult.empty()
|
2023-09-15 00:35:48 +00:00
|
|
|
result = stage.run(
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
sources,
|
|
|
|
highres=HighresParams(False, 1, 0, 0),
|
|
|
|
upscale=UpscaleParams(""),
|
|
|
|
origin=Size(0, 0),
|
|
|
|
size=Size(128, 128),
|
|
|
|
stage_source=stage_source,
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertEqual(len(result), 0)
|