[1]:
    from wtypes import *
    import pytest, anyconfig
[2]:
    def test_load_config():
        class BadProject(Bunch):
            tool: Dict
            __annotations__ = {'build-system': Integer}

        with pytest.raises(ValidationError):
            BadProject().load('pyproject.toml')

        class PyProject(Bunch):
            tool: Dict
            __annotations__ = {'build-system': Dict}
        PyProject().load('pyproject.toml')
[3]:
    def test_dict():
        class Thing(Dict):
            a: Integer

        assert Thing._schema.toDict() == {'type': 'object', 'properties': {'a': {'type': 'integer'}}}
        assert Thing(a=1)
        with pytest.raises(ValidationError):
            Thing(a='abc')

[4]:
    def test_bunch():
        class Thing(Bunch):
            a: Integer

        assert Thing._schema.toDict() == {'type': 'object', 'properties': {'a': {'type': 'integer'}}}
        t = Thing(a=1)
        assert t.a == 1
        with pytest.raises(ValidationError):
            Thing(a='abc')

[5]:
    def test_dataclass():
        class Thing(DataClass):
            a: Integer

        assert dataclasses.is_dataclass(Thing)
        assert Thing._schema.toDict() == {'type': 'object', 'properties': {'a': {'type': 'integer'}}}
        assert Thing(a=1)
        with pytest.raises(ValidationError):
            Thing(a='abc')