Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conformity/fields/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def errors(self, value): # type: (AnyType) -> ListType[Error]
Error(
'Extra keys present: {}'.format(', '.join(six.text_type(key) for key in sorted(extra_keys))),
code=ERROR_CODE_UNKNOWN,
pointer=six.text_type(sorted(extra_keys)[0]),
),
)

Expand Down
6 changes: 5 additions & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ def test_complex(self): # type: () -> None
sorted([
Error('Not an integer', pointer='child_ids.2'),
Error('Missing key: address', code=ERROR_CODE_MISSING, pointer='address'),
Error('Extra keys present: another_bad, unsolicited_item', code=ERROR_CODE_UNKNOWN),
Error(
Comment thread
lautaro-eb marked this conversation as resolved.
Outdated
'Extra keys present: another_bad, unsolicited_item',
code=ERROR_CODE_UNKNOWN,
pointer='another_bad',
),
Error('Not a set or frozenset', pointer='unique_things'),
]),
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test_validation(self):
},
})

assert '- inner_qux: Extra keys present: not_defined' in error_context.value.args[0]
assert '- inner_qux.not_defined: Extra keys present: not_defined' in error_context.value.args[0]

with pytest.raises(Settings.ImproperlyConfigured) as error_context:
SettingsTwo({
Expand Down