From d59ad524e667dcd4c9d9c6190f097bc4767b95cb Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Fri, 18 May 2012 12:11:04 +0200 Subject: [PATCH] Add a test for unset attributes --- wsme/tests/test_restjson.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wsme/tests/test_restjson.py b/wsme/tests/test_restjson.py index dd298d4..79f67a7 100644 --- a/wsme/tests/test_restjson.py +++ b/wsme/tests/test_restjson.py @@ -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], []) == []