def test_type_cast_exception_non_nonetype():
"""Make sure our type casting exceptions are informative"""
class A(Enumap):
a: int = auto()
this_here_is_a_fine_key = auto()
with pytest.raises(TypeCastError) as e:
A.tuple_casted("1.0", None)
assert "'a' got invalid value '1.0'" in str(e)
assert "of type str" in str(e)
assert e.value.key == "a"
评论列表
文章目录