rename exception attr to fields from items, add a test for it
This commit is contained in:
@@ -212,9 +212,9 @@ class UnsupportedFields(Invalid):
|
||||
cstruct during deserialize.
|
||||
"""
|
||||
|
||||
def __init__(self, node, items, msg=None):
|
||||
def __init__(self, node, fields, msg=None):
|
||||
super(UnsupportedFields, self).__init__(node, msg)
|
||||
self.items = items
|
||||
self.fields = fields
|
||||
|
||||
|
||||
class All(object):
|
||||
|
@@ -724,6 +724,7 @@ class TestMapping(unittest.TestCase):
|
||||
typ = self._makeOne(unknown='raise')
|
||||
e = invalid_exc(typ.deserialize, node, {'a':1, 'b':2})
|
||||
self.assertTrue(isinstance(e, colander.UnsupportedFields))
|
||||
self.assertEqual(e.fields, {'b': 2})
|
||||
self.assertEqual(e.msg.interpolate(),
|
||||
"Unrecognized keys in mapping: \"{'b': 2}\"")
|
||||
|
||||
|
Reference in New Issue
Block a user