Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowing use of None as missing for Numbers #59

Merged
merged 1 commit into from Aug 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion colander/__init__.py
Expand Up @@ -951,7 +951,7 @@ class Number(SchemaType):
num = None

def serialize(self, node, appstruct):
if appstruct is null:
if not appstruct:
return null

try:
Expand Down
8 changes: 8 additions & 0 deletions colander/tests/test_colander.py
Expand Up @@ -1148,6 +1148,14 @@ def test_serialize_null(self):
result = typ.serialize(node, val)
self.assertEqual(result, colander.null)

def test_serialize_none(self):
import colander
val = None
node = DummySchemaNode(None)
typ = self._makeOne()
result = typ.serialize(node, val)
self.assertEqual(result, colander.null)

def test_serialize_emptystring(self):
import colander
val = ''
Expand Down