test_jstraitlets.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:schemapi 作者: altair-viz 项目源码 文件源码
def test_to_from_dict_with_defaults():
    dct = {'x': 4, 'y': {'val': 'hello', 'other_val': 'hello 2'}}
    obj = Foo.from_dict(dct)
    dct2 = obj.to_dict()
    assert dct == dct2

    dct = {'x': 4, 'z': 'blah', 'y': {'val': 'hello'}}
    with pytest.raises(T.TraitError):
        Foo.from_dict(dct)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号