What's Changed
- feat: raise
UndefinedKey
exception on user decision by @FelixTheC in #130- new exception type
UndefinedKey
- new allowed parameter(
throw_on_undefined
) formatch_class_typing
which will be thrown if you try to init a TypeDict with an unspecified attribute/key
- new exception type
- test case example:
def test_new_parameter():
@match_class_typing(throw_on_undefined=True)
class User(TypedDict):
id: str
username: str
description: str | None
with pytest.raises(UndefinedKey):
User({"id": "0123", "username": "test", "description": None, "age": 10})
Full Changelog: v3.12.0...v3.12.1