alecthomas / alecthomas/voluptuous
Nested exclusion groups do not function as expected
- Lenguaje dominante
- Python
- Estrellas
- 1.9k
- Forks
- 237
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
With the below schema, you would expect "foo" to be exclusive with both "bar" and "baz":
```
>>> s = Schema({Exclusive(Exclusive("foo", 1), 2): str, Exclusive("bar", 1): str, Exclusive("baz", 2): str})
```
However, it appears that the inner 'Exclusive' object is ignored when they are nested. So "foo" does exclude "baz", as expected:
```
>>> s({"foo": "", "baz":"",})
Traceback (most recent call last):
File "", line 1, in
File "/home/wmiller/venv/lib/python2.7/site-packages/voluptuous/schema_builder.py", line 221, in __call__
return self._compiled([], data)
File "/home/wmiller/venv/lib/python2.7/site-packages/voluptuous/schema_builder.py", line 520, in validate_dict
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: two or more values in the same group of exclusion '2' @ data[<2>]
```
But "foo" does **not** exclude "bar":
```
>>> s({"foo": "", "bar":"",})
{'foo': '', 'bar': ''}
```
The tests above were performed on voluptuous 0.10.5.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.