diff --git a/voluptuous/tests/tests.py b/voluptuous/tests/tests.py index d415cba..8af39a1 100644 --- a/voluptuous/tests/tests.py +++ b/voluptuous/tests/tests.py @@ -506,6 +506,7 @@ def test_maybe(): s = Schema(Maybe(int)) assert s(1) == 1 + assert s(None) is None assert_raises(Invalid, s, 'foo') diff --git a/voluptuous/validators.py b/voluptuous/validators.py index 8e4ef43..08fb0bf 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -462,7 +462,7 @@ def PathExists(v): class Maybe(object): """Validate that the object is of a given type or is None. - :raises Invalid: if the value is not of the type declared or None + :raises Invalid: if the value is not of the type declared and is not None >>> s = Schema(Maybe(int)) >>> s(10)