From 5b659a948a4483857b871b29a93786823380f736 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Wed, 13 Sep 2023 22:56:23 -0500 Subject: [PATCH] more stage tests --- api/tests/chain/test_blend_mask.py | 23 +++++++++++++++++++++++ api/tests/chain/test_reduce_crop.py | 23 +++++++++++++++++++++++ api/tests/chain/test_upscale_highres.py | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 api/tests/chain/test_blend_mask.py create mode 100644 api/tests/chain/test_reduce_crop.py diff --git a/api/tests/chain/test_blend_mask.py b/api/tests/chain/test_blend_mask.py new file mode 100644 index 00000000..410249fe --- /dev/null +++ b/api/tests/chain/test_blend_mask.py @@ -0,0 +1,23 @@ +import unittest +from PIL import Image + +from onnx_web.chain.blend_mask import BlendMaskStage +from onnx_web.params import HighresParams, UpscaleParams + + +class BlendMaskStageTests(unittest.TestCase): + def test_empty(self): + stage = BlendMaskStage() + sources = [] + result = stage.run( + None, + None, + None, + None, + sources, + highres=HighresParams(False, 1, 0, 0), + upscale=UpscaleParams(""), + stage_mask=Image.new("RGBA", (64, 64)), + ) + + self.assertEqual(len(result), 0) diff --git a/api/tests/chain/test_reduce_crop.py b/api/tests/chain/test_reduce_crop.py new file mode 100644 index 00000000..4e79d8f8 --- /dev/null +++ b/api/tests/chain/test_reduce_crop.py @@ -0,0 +1,23 @@ +import unittest + +from onnx_web.chain.reduce_crop import ReduceCropStage +from onnx_web.params import HighresParams, Size, UpscaleParams + + +class ReduceCropStageTests(unittest.TestCase): + def test_empty(self): + stage = ReduceCropStage() + sources = [] + result = stage.run( + None, + None, + None, + None, + sources, + highres=HighresParams(False, 1, 0, 0), + upscale=UpscaleParams(""), + origin=Size(0, 0), + size=Size(128, 128), + ) + + self.assertEqual(len(result), 0) diff --git a/api/tests/chain/test_upscale_highres.py b/api/tests/chain/test_upscale_highres.py index f5e17a84..95897c2c 100644 --- a/api/tests/chain/test_upscale_highres.py +++ b/api/tests/chain/test_upscale_highres.py @@ -10,4 +10,4 @@ class UpscaleHighresStageTests(unittest.TestCase): sources = [] result = stage.run(None, None, None, None, sources, highres=HighresParams(False,1, 0, 0), upscale=UpscaleParams("")) - self.assertEqual(len(result), 0) \ No newline at end of file + self.assertEqual(len(result), 0)