Catch AttributeError for FormatString configtype
(cherry picked from commit b171f3c0f2)
This commit is contained in:
parent
74903367ed
commit
da0a1afad2
|
|
@ -1567,7 +1567,7 @@ class FormatString(BaseType):
|
|||
|
||||
try:
|
||||
value.format(**{k: '' for k in self.fields})
|
||||
except (KeyError, IndexError) as e:
|
||||
except (KeyError, IndexError, AttributeError) as e:
|
||||
raise configexc.ValidationError(value, "Invalid placeholder "
|
||||
"{}".format(e))
|
||||
except ValueError as e:
|
||||
|
|
|
|||
|
|
@ -1832,6 +1832,8 @@ class TestFormatString:
|
|||
'{foo} {bar} {baz}',
|
||||
'{foo} {bar',
|
||||
'{1}',
|
||||
'{foo.attr}',
|
||||
'{foo[999]}',
|
||||
])
|
||||
def test_to_py_invalid(self, typ, val):
|
||||
with pytest.raises(configexc.ValidationError):
|
||||
|
|
|
|||
Loading…
Reference in New Issue