From 6357486dedb886861dedd2ac1eeee13781d45320 Mon Sep 17 00:00:00 2001 From: Felix Kleinert <f.kleinert@fz-juelich.de> Date: Tue, 3 Mar 2020 11:27:59 +0100 Subject: [PATCH] update test to cover all cases #56 --- .../test_advanced_paddings.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_model_modules/test_advanced_paddings.py b/test/test_model_modules/test_advanced_paddings.py index be268d40..7142e1c2 100644 --- a/test/test_model_modules/test_advanced_paddings.py +++ b/test/test_model_modules/test_advanced_paddings.py @@ -29,6 +29,22 @@ class TestPadUtils: PadUtils.get_padding_for_same((1, 1), strides=-1) assert 'Strides other than 1 not implemented!' in str(einfo.value) + def test_get_padding_for_same_non_int_kernel(self): + with pytest.raises(ValueError) as einfo: + PadUtils.get_padding_for_same((1., 1)) + assert "The `kernel_size` argument must have a tuple of integers. Got: (1.0, 1) " \ + "of type [<class 'float'>, <class 'int'>]" in str(einfo.value) + + with pytest.raises(ValueError) as einfo: + PadUtils.get_padding_for_same((1, 1.)) + assert "The `kernel_size` argument must have a tuple of integers. Got: (1, 1.0) " \ + "of type [<class 'int'>, <class 'float'>]" in str(einfo.value) + + with pytest.raises(ValueError) as einfo: + PadUtils.get_padding_for_same((1, '1.')) + assert "The `kernel_size` argument must have a tuple of integers. Got: (1, '1.') " \ + "of type [<class 'int'>, <class 'str'>]" in str(einfo.value) + def test_get_padding_for_same_stride_3d(self): kernel = (3, 3, 3) pad = PadUtils.get_padding_for_same(kernel) @@ -50,6 +66,8 @@ class TestPadUtils: PadUtils.get_padding_for_same((2, 4)) assert 'even kernel size not implemented. Got (2, 4)' in str(einfo.value) + ################################################################################## + def test_check_padding_format_negative_pads(self): with pytest.raises(ValueError) as einfo: -- GitLab