Fix conversion to item_type on __call__ in List type
Change-Id: I365eec5785023135ce6aaceaec425e23fe4301f0 Closes-Bug: #1640962
This commit is contained in:
parent
38246b6f4f
commit
42af1ad069
oslo_config
@ -531,6 +531,11 @@ class ListTypeTests(TypeTestHelper, unittest.TestCase):
|
|||||||
self.assertConvertedValue('1,2,3,5',
|
self.assertConvertedValue('1,2,3,5',
|
||||||
[1, 2, 3, 5])
|
[1, 2, 3, 5])
|
||||||
|
|
||||||
|
def test_tuple_of_custom_type(self):
|
||||||
|
self.type_instance = types.List(types.Integer())
|
||||||
|
self.assertConvertedValue(('1', '2', '3', '5'),
|
||||||
|
[1, 2, 3, 5])
|
||||||
|
|
||||||
def test_bounds_parsing(self):
|
def test_bounds_parsing(self):
|
||||||
self.type_instance = types.List(types.Integer(), bounds=True)
|
self.type_instance = types.List(types.Integer(), bounds=True)
|
||||||
self.assertConvertedValue('[1,2,3]', [1, 2, 3])
|
self.assertConvertedValue('[1,2,3]', [1, 2, 3])
|
||||||
|
@ -441,7 +441,7 @@ class List(ConfigType):
|
|||||||
|
|
||||||
def __call__(self, value):
|
def __call__(self, value):
|
||||||
if isinstance(value, (list, tuple)):
|
if isinstance(value, (list, tuple)):
|
||||||
return list(value)
|
return list(six.moves.map(self.item_type, value))
|
||||||
|
|
||||||
s = value.strip()
|
s = value.strip()
|
||||||
if self.bounds:
|
if self.bounds:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user