alecthomas / voluptuous

CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
https://pypi.org/project/voluptuous
BSD 3-Clause "New" or "Revised" License
1.82k stars 218 forks source link

Remove value enumeration when validating empty list #434

Closed monopolis closed 3 years ago

monopolis commented 4 years ago

The behaviour seems to have been introduced in commit 95489bd443e9a654 that modified the schema of an empty list in order to provide a consistent behaviour between Schema({}) and Schema([]).

The commit introduced an enumeration of the incorrect values rather than the expected behaviour of showing the key with the incorrect value.

This commit provides the expected behaviour, and is also consistent with the 'pathless' behaviour currently implemented, meaning that

Finally, as new unit test is provided to ensure that the new behaviour remains intact.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.8%) to 95.617% when pulling 10a78d033c3c56448c8af4e7f70a237a5826e65f on monopolis:issue-397 into 7151438f2957debb04019400e6552965fd04c867 on alecthomas:master.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.8%) to 95.617% when pulling 10a78d033c3c56448c8af4e7f70a237a5826e65f on monopolis:issue-397 into 7151438f2957debb04019400e6552965fd04c867 on alecthomas:master.