alecthomas / alecthomas/voluptuous
Nested exclusion groups do not function as expected
- Ngôn ngữ chính
- Python
- Star
- 1.9k
- Fork
- 237
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.