Allow the use of 'missing=None' for Number

This commit is contained in:
Daniel Nouri
2012-08-15 13:18:38 +02:00
parent 979cd65705
commit 24f648dd14
4 changed files with 15 additions and 2 deletions

View File

@@ -1,6 +1,12 @@
Changes
=======
Next release
------------
- Allow the use of 'missing=None' for Number. See
https://github.com/Pylons/colander/pull/59 .
0.9.8 (2012-04-27)
------------------

View File

@@ -951,7 +951,7 @@ class Number(SchemaType):
num = None
def serialize(self, node, appstruct):
if not appstruct:
if appstruct in (null, None):
return null
try:

View File

@@ -1192,6 +1192,13 @@ class TestInteger(unittest.TestCase):
result = typ.serialize(node, val)
self.assertEqual(result, '1')
def test_serialize_zero(self):
val = 0
node = DummySchemaNode(None)
typ = self._makeOne()
result = typ.serialize(node, val)
self.assertEqual(result, '0')
class TestFloat(unittest.TestCase):
def _makeOne(self):
from colander import Float

View File

@@ -32,7 +32,7 @@ testing_extras = ['nose', 'coverage']
docs_extras = ['Sphinx']
setup(name='colander',
version='0.9.8',
version='0.9.9dev1',
description=('A simple schema-based serialization and deserialization '
'library'),
long_description=README + '\n\n' + CHANGES,