dataclass utilities
from dataclasses import dataclass
from dataclasses_json import dataclass_json
import pytest
@enforce_types
@dataclass_json
@dataclass
class TestObject:
id_:int
name:str
## should pass
TestObject.from_dict({'id_':123,'name':'123'})
## should fail
with pytest.raises(TypeError):
TestObject.from_dict({'id_':'123', 'name':'123'})
raise Exception('test should fail')