Permalink
Browse files

Merge branch 'string_type_serialize_empty_string' of git://github.com…

…/tranminhh/colander into tranminhh-string_type_serialize_empty_string
  • Loading branch information...
2 parents 4119b8e + ad04ea6 commit 319705a9afa3eb7b3f9ea446de69c03f6ce769b6 @mcdonc mcdonc committed Jan 10, 2013
Showing with 9 additions and 1 deletion.
  1. +1 −1 colander/__init__.py
  2. +8 −0 colander/tests/test_colander.py
View
@@ -1013,7 +1013,7 @@ def __init__(self, encoding=None):
self.encoding = encoding
def serialize(self, node, appstruct):
- if not appstruct:
+ if appstruct in (null, None):
return null
try:
@@ -1234,6 +1234,14 @@ def test_serialize_none(self):
result = typ.serialize(node, val)
self.assertEqual(result, colander.null)
+ def test_serialize_emptystring(self):
+ import colander
+ val = u''
+ node = DummySchemaNode(None)
+ typ = self._makeOne()
+ result = typ.serialize(node, val)
+ self.assertEqual(result, val)
+
def test_serialize_uncooperative(self):
val = Uncooperative()
node = DummySchemaNode(None)

0 comments on commit 319705a

Please sign in to comment.