New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate.ContainsOnly raises error if input contains duplicate, valid entries #603

Closed
sloria opened this Issue Mar 18, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@sloria
Member

sloria commented Mar 18, 2017

Reported in #516 (comment):

As pointed out by @maximkulkin

validate.ContainsOnly([1, 2, 3])([1, 2, 3, 3])

raises ValidationError.

It seems intended (explicit del choices[index] in the code) but is not explicit in the docs, and in fact, I don't get the rationale.

The docs says

succeeds if value is a sequence and each element in the sequence is also in the sequence passed as choices

This behavior is unintended. Duplicate, valid entries should be considered valid.

lafrech added a commit to Nobatek/marshmallow that referenced this issue Mar 18, 2017

lafrech added a commit to Nobatek/marshmallow that referenced this issue Mar 18, 2017

@sloria sloria closed this in #604 Mar 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment