diff options
author | Gevorg Davoian <gdavoian@mirantis.com> | 2016-11-16 14:55:37 +0200 |
---|---|---|
committer | Gevorg Davoian <gdavoian@mirantis.com> | 2016-11-16 16:39:58 +0000 |
commit | 42af1ad069ce09c465101cd2dcad93940c856c94 (patch) | |
tree | 69bd8400d49cb02c36643dfa3d66f54320975951 | |
parent | 38246b6f4f8701f0067aea7d2ee5a7b5f786743f (diff) | |
download | oslo-config-42af1ad069ce09c465101cd2dcad93940c856c94.tar.gz |
Fix conversion to item_type on __call__ in List type
Change-Id: I365eec5785023135ce6aaceaec425e23fe4301f0
Closes-Bug: #1640962
-rw-r--r-- | oslo_config/tests/test_types.py | 5 | ||||
-rw-r--r-- | oslo_config/types.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/oslo_config/tests/test_types.py b/oslo_config/tests/test_types.py index 2389d9b..c494297 100644 --- a/oslo_config/tests/test_types.py +++ b/oslo_config/tests/test_types.py @@ -531,6 +531,11 @@ class ListTypeTests(TypeTestHelper, unittest.TestCase): self.assertConvertedValue('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): self.type_instance = types.List(types.Integer(), bounds=True) self.assertConvertedValue('[1,2,3]', [1, 2, 3]) diff --git a/oslo_config/types.py b/oslo_config/types.py index 4096f2e..24768bc 100644 --- a/oslo_config/types.py +++ b/oslo_config/types.py @@ -441,7 +441,7 @@ class List(ConfigType): def __call__(self, value): if isinstance(value, (list, tuple)): - return list(value) + return list(six.moves.map(self.item_type, value)) s = value.strip() if self.bounds: |