π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
test(enhance): improve exception assertions in posterize tests (#3603)
Ayushi Jainee1d3097b319
diff --git a/tests/enhance/test_adjust.py b/tests/enhance/test_adjust.pyindex f69bc020b..b14cae9cf 100644--- a/tests/enhance/test_adjust.py+++ b/tests/enhance/test_adjust.py@@ -1223,11 +1223,17 @@ class TestPosterize(BaseTester):def test_exception(self, device, dtype):img = torch.ones(2, 3, 4, 5, device=device, dtype=dtype)+ # invalid input typewith pytest.raises(TypeError):- assert TestPosterize.f([1.0], 0.0)+ TestPosterize.f([1.0], 0)+ # bits must be int or tensorwith pytest.raises(TypeError):- assert TestPosterize.f(img, 1.0)+ TestPosterize.f(img, 1.0)++ # batch size mismatch between bits tensor and input+ with pytest.raises(AssertionError):+ TestPosterize.f(img, torch.tensor([1, 2, 3], device=device))# TODO(jian): add better cases@pytest.mark.skipif(kornia.core.utils.xla_is_available(), reason="issues with xla device")