Add a test for unset attributes

This commit is contained in:
Christophe de Vienne
2012-05-18 12:11:04 +02:00
parent 00c042aa73
commit d59ad524e6

View File

@@ -188,6 +188,15 @@ class TestRestJson(wsme.tests.protocol.ProtocolTestCase):
assert json.loads(r.text)['faultstring'].startswith(
"Unknown argument:")
def test_unset_attrs(self):
class AType(object):
attr = int
wsme.types.register_type(AType)
j = tojson(AType, AType())
assert j == {}
def test_array_tojson(self):
assert tojson([int], None) is None
assert tojson([int], []) == []