Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_whitespace_separated_string(self):
config = _root({'foo': 'bar baz'})
valid = config['foo'].get(confuse.StrSeq())
self.assertEqual(valid, ['bar', 'baz'])
def test_string_tuple(self):
config = _root({'foo': ('bar', 'baz')})
valid = config['foo'].get(confuse.StrSeq())
self.assertEqual(valid, ['bar', 'baz'])
def test_string_list(self):
config = _root({'foo': ['bar', 'baz']})
valid = config['foo'].get(confuse.StrSeq())
self.assertEqual(valid, ['bar', 'baz'])
def test_invalid_type(self):
config = _root({'foo': 9})
with self.assertRaises(confuse.ConfigTypeError):
config['foo'].get(confuse.StrSeq())
def test_invalid_sequence_type(self):
config = _root({'foo': ['bar', 2126]})
with self.assertRaises(confuse.ConfigTypeError):
config['foo'].get(confuse.StrSeq())
def get_config_template():
template = {
'enabled': confuse.TypeTemplate(bool),
'friends': confuse.StrSeq(),
'tag_keywords': confuse.StrSeq(),
'friend_keywords': confuse.StrSeq(),
'number_keywords': NumberKeywordsTemplate()
}
return template
def get_config_template():
template = {
'enabled': confuse.TypeTemplate(bool),
'keywords': confuse.StrSeq()
}
return template
def get_config_template():
# Fixme: minor hack because StrSeq doesnt support default
strseq = confuse.StrSeq()
strseq.default = []
template = {
'enabled': confuse.TypeTemplate(bool),
'keywords': strseq,
'users': strseq,
}
return template
def get_config_template():
template = {
'enabled': confuse.TypeTemplate(bool),
'friends': confuse.StrSeq(),
'tag_keywords': confuse.StrSeq(),
'friend_keywords': confuse.StrSeq(),
'number_keywords': NumberKeywordsTemplate()
}
return template