Skip to content

Commit

Permalink
Revert "Raise an error when setting None to a base Parameter with `…
Browse files Browse the repository at this point in the history
…allow_None=False` (#691)" (#712)

This reverts commit 6c995be.
  • Loading branch information
maximlt authored Mar 13, 2023
1 parent 369bc1f commit ac909f9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
2 changes: 0 additions & 2 deletions param/parameterized.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
24 changes: 0 additions & 24 deletions tests/API1/testparameterizedobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit ac909f9

Please sign in to comment.