Skip to content

3.12.1

Latest
Compare
Choose a tag to compare
@FelixTheC FelixTheC released this 04 Dec 20:58
· 2 commits to py_3_12 since this release

What's Changed

  • feat: raise UndefinedKey exception on user decision by @FelixTheC in #130
    • new exception type UndefinedKey
    • new allowed parameter(throw_on_undefined) for match_class_typing which will be thrown if you try to init a TypeDict with an unspecified attribute/key
  • 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