From ac909f9cdfac2efd4eaa6d927229924a2cd7f03a Mon Sep 17 00:00:00 2001 From: Maxime Liquet <35924738+maximlt@users.noreply.github.com> Date: Mon, 13 Mar 2023 17:56:54 +0100 Subject: [PATCH] Revert "Raise an error when setting `None` to a base Parameter with `allow_None=False` (#691)" (#712) This reverts commit 6c995be4bec24899ed47d81ad6d34d8016108654. --- param/parameterized.py | 2 -- tests/API1/testparameterizedobject.py | 24 ------------------------ 2 files changed, 26 deletions(-) diff --git a/param/parameterized.py b/param/parameterized.py index 5da660071..607e01f94 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -1255,8 +1255,6 @@ def __set__(self, obj, val): def _validate_value(self, value, allow_None): """Implements validation for parameter value""" - if value is None and allow_None is False: - raise ValueError("Parameter %r does not accept `None`." % (self.name)) def _validate(self, val): """Implements validation for the parameter value and attributes""" diff --git a/tests/API1/testparameterizedobject.py b/tests/API1/testparameterizedobject.py index 1bf27c93b..b6efaecc0 100644 --- a/tests/API1/testparameterizedobject.py +++ b/tests/API1/testparameterizedobject.py @@ -392,30 +392,6 @@ class TestPO1(param.Parameterized): x = param.Number(default=numbergen.UniformRandom(lbound=-1,ubound=1,seed=1),bounds=(-1,1)) y = param.Number(default=1,bounds=(-1,1)) - -class TestParameter(API1TestCase): - - def setUp(self): - super(TestParameter, self).setUp() - - class _TestParameter(param.Parameterized): - a = param.Parameter(default='') - b = param.Parameter(default='',allow_None=True) - c = param.Parameter(default=None) - - self._TestParameter = _TestParameter - - def test_handling_of_None(self): - t = self._TestParameter() - - with self.assertRaises(ValueError): - t.a = None - - t.b = None - - assert t.c is None - - class TestNumberParameter(API1TestCase): def test_outside_bounds(self):