Skip to content
Snippets Groups Projects
Commit 2475f30a authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

swh.core.config: implement lists of str/int

parent efb7246f
Branches azuregraphdocs
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ import os
_map_convert_fn = {
'int': int,
'bool': lambda x: x.lower() == 'true',
'list[str]': lambda x: [value.strip() for value in x.split(',')],
'list[int]': lambda x: [int(value.strip()) for value in x.split(',')],
}
......
......@@ -25,6 +25,8 @@ class ConfReaderTest(unittest.TestCase):
a = 1
b = this is a string
c = true
ls = list, of, strings
li = 1, 2, 3, 4
""")
@classmethod
......@@ -42,6 +44,8 @@ c = true
'e': ('int', None),
'f': ('bool', None),
'g': ('string', None),
'ls': ('list[str]', ['a', 'b', 'c']),
'li': ('list[int]', [42, 43]),
}
# when
......@@ -56,6 +60,8 @@ c = true
'e': None,
'f': None,
'g': None,
'ls': ['list', 'of', 'strings'],
'li': [1, 2, 3, 4],
})
@istest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment