alecthomas / alecthomas/voluptuous
Allow ensuring a key does not exist in a dict
- Vorherrschende Sprache
- Python
- Sterne
- 1.9k
- Forks
- 237
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I am using the library to validate JSON responses in my REST API, by doing something like:
```
resp = requests.get(...)
assert Schema({...}) in resp.json()
```
(I have couple of utility functions in there to make this work with pytest.)
It would be nice to have a construct that allowed to describe a key that may NOT exist in the response. Consider example.
```
resp = request.patch(...remove-a-key...)
assert Schema({
Missing('that-key'): None
}) in resp.json()
```
...or maybe it could be in `Schema.__init__` as `exclude=['field1', 'field2']` or something.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.