Accept set as a valid [str]
This commit is contained in:
Родитель
0ebe854c0a
Коммит
6d1b656290
|
@ -1151,7 +1151,7 @@ class Deserializer(object):
|
|||
"""
|
||||
if attr is None:
|
||||
return None
|
||||
if not isinstance(attr, list):
|
||||
if not isinstance(attr, (list, set)):
|
||||
raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(
|
||||
iter_type,
|
||||
type(attr)
|
||||
|
|
|
@ -1432,6 +1432,9 @@ class TestRuntimeDeserialized(unittest.TestCase):
|
|||
response = self.d(self.TestObj, response_data)
|
||||
deserialized_list = [d for d in response.attr_d]
|
||||
|
||||
self.assertListEqual(sorted(self.d("[str]", ["a", "b", "c"])), ["a", "b", "c"])
|
||||
self.assertListEqual(sorted(self.d("[str]", {"a", "b", "c"})), ["a", "b", "c"])
|
||||
|
||||
def test_attr_list_in_list(self):
|
||||
"""
|
||||
Test deserializing a list of lists
|
||||
|
|
Загрузка…
Ссылка в новой задаче